Skip to content
Advertisement

Is it possible to force a web app in Php to work with a desktop app in Java?

A simple socktet app. There is a server, and multiple clients from all around the world can connect to this server using its IP address and a port number. And right after that, you can send a messenge, and everyone who is connected will be able to see it.

Advertisement

Answer

You are almost there dude, you willing to have chat application which can be operated from android,IOS, desktop application and web browsers as well, so as you said you done with JAVA socket server program which is primarily desktop based at the moment, as you said you are making use of RAW socket programming which is good upto mobile & desktop applications , but what about web application? yes not possible in that case.

So in order to make it happen for all possible available gadgets today including smart phones, smart watches, using web browsers, and desktop applications as well you have to make use of WebSockets,

WebSocket is a protocol providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.

You can understand a bit about WebSockets from here:

websocket.org

socket.io

So here comes a concept of WebSockets, using which you can achieve almost what you are supposed to do. So you can do few things out of following to achieve this:

  1. You can modify your existing JAVA program to handle WebSocket connection instead of dealing with RAW sockets, which you are doing currently.

  2. Another possibility you can write your server WS(WebSocket) program in Python or node.JS, which is far easy to develop, and host on any free PaSS cloud services like heroku,openshift or even AWS.

So, in this case once you created/modified your existing server program to WS, all you have to do is create client side programs in either or all of the following:

  1. IOS app
  2. Android APP
  3. Desktop App(In .NET or JAVA or Python)
  4. Website in PHP or Python(Using JavaScript WS client libraries)

you can create the client side programs in any or all of above platforms, the WS client libraries are almost available for all of the platform’s mentioned above.

So, what once you done with Sever side you can host your server side program on openshift, which is free to use PaSS cloud service far better than rest of the PaSS services available today.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement