Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java server and socket.io

Are there any examples(ready scripts) to connect to java server with socket.io library? My problem: I have a server that works on java (proceed some data from clients) and a java client that is always connected to server (server is to be informed when a client is disconnected). I want to create a javascript extension for google chrome that replace this java client. But now server and client communicate now with simple text protocol.

like image 812
user1081056 Avatar asked Mar 01 '12 10:03

user1081056


People also ask

Does Socket.IO work in Java?

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1. 0 and later.

Does Socket.IO need a server?

Socket.io, and WebSockets in general, require an http server for the initial upgrade handshake. So even if you don't supply Socket.io with an http server it will create one for you. The issue is that the second parameter in your io. listen(3000, '0.0.

Can I use Socket.IO with spring boot?

So yes, you can use (on open-source Java implementation) of Socket.IO together with Spring Boot.


1 Answers

There are several java libraries that provide java's connectivity with socket.io client.

Servers

  1. ibdknox/socket.io-netty (NOTE: not updated since 2011, not compatible with socket.io v0.7 or above)
  2. avostryakov/Socket.IO-Java (a fork of Ovea/Socket.IO-Java which is no longer available)
  3. mrniko/netty-socketio
  4. Atmosphere/atmosphere (see Getting-Started-with-Socket.IO)
  5. trinopoty/socket.io-server-java (based on the official engine.io Java server but modified for normal socket.io)

The trinopoty and mrniko servers are both mentioned on the official docs for socket.io under "other server implementations".

Clients

  1. Official Java client
  2. benkay/java-socket.io.client (NOTE: no longer maintained)
  3. Gottox/socket.io-java-client (NOTE: repository has now been archived)
like image 154
Ali Raza Avatar answered Oct 12 '22 01:10

Ali Raza