Socket io connecting server in java - sockets

Please give me an example on socket io connecting the server using java client and server. Describe socket io jar details also. I have googled but does not get the correct source code.

Socket.IO Server is not a Java implementation.
Consequentially you can not have a Java server.
You need to get some Java adaptation of Socket.IO, example:
Netty Socket.IO Java Implementation
Fortunately, Socket.IO has a Java client implementation you can use.
Socket.IO Java Client Implementation
Both links have examples and demo's.

Related

Upgrade to webSocket message in play web sockets using scala

I am new to play framework and implementing web sockets using iteratees in Scala but when I run in browser it prints upgrade to Web sockets required with no compiler error. I have attached my snippet here. Please help. Am using Ubuntu platform.

How to use Fingale futures to an existing Restful webservice

I have a webservice running on jboss server. I can't change it to netty because i'm using other features of jboss. But i want to use finagles futures from the client. Is there a way ?
The Future class used in Finagle is part of Twitter's util project, which is open source. com.twitter.util.Future is usable on its own within any project that adds util-core as a dependency.
You can always use a finagle client to make calls to an HTTP [or other RPC protocol] webservice. It doesn't matter how the service is implemented as along as it uses the protocol correctly. If you are using Java, this link should give you details on how to build a finagle client for an HTTP service: https://github.com/twitter/finagle#Building%20a%20Client%20in%20Java
Here's some sample code to for a more elaborate finagle HTTP client: https://github.com/twitter/finagle/blob/master/finagle-example/src/main/scala/com/twitter/finagle/example/http/HttpClient.scala

Can I use socket.io with Play Framework 2.0 Web Sockets?

There's a sample application that comes with Play Framework 2.0. The application uses Play's WebSocket implementation on the server side. I am wondering can I use socket.io on the client side to connect with Play's WebSocket implementation on the server side?
In theory, yes, you can make Socket.io connect to your websocket server wia the corresponding ws url.
In practice, I tried and I had some issues, so it might require you to adapt Socket.io for it to work properly. Granted I tried on 2.0.1 or similar, so it may be working currently with no issues.

Socket communication?

What are the preferred platforms to implement TCP socket communication?
I'm interested in:
scripting languages (eg Swocket for Python)
and runtimes (eg .NET / Java).
In Java, we use Apache Mina,
http://mina.apache.org/
Its performance rivals C implementation.
Socket communication implemented using Java NIO might be a good method. Some of Java based web servers use it. I remember jetty using it. Here is a link from Sun.

Communicating with Java web app from non-java app through TCP/IP socket

Hosting an application on a web application server e.g. JBoss automatically brings in lots of app server specific functionalities with it e.g. security, clustering & load balancing etc. I have a situation where I have to develop a server app with which, legacy apps can talk to over TCP/IP socket as well as be highly available. Initially, I had though of using JBoss app server to leverage its clustering support for HA. However, I am not sure whether it would be possible to connect to a JBoss web app using pure TCP/IP sockets from both java and non-java apps.
What is the best way to achieve this without using web service or Http approach?
UPDATE: I am specially interested to know how legacy apps will connect to the hosted web app through TCP/IP socket.
A really simple solution to bridge the two worlds would be to add a simple Java server which maps the old TCP/IP requests to HTTP requests. This is probably a pretty braindead task, so this "server" will be simple to write and maintain. Also, this server won't need as much power since it just accepts and forwards connections (no business logic or DB code).
On the JBoss server, you develop like you normally would. The legacy apps connect to the little bridge server which passes the requests on to JBoss and translate the result back.
This ensures that you're building for the future: When new apps are developed, they can connect directly to JBoss and use all the great HTTP features.
There's no reason why you can't open up a normal socket in (say) a servlet application hosted in JBoss.
You can then get a byte stream from this. The headache is then to decide on a platform-independent representation of your messages, such that your client end can format and send such that the JBoss-hosted end can read. But it's all perfectly feasible.
I would implement a very simple http (1.0) client.