Sathish Kumar k k
Sathish Kumar k k

Reputation: 1842

Web Socket java client outside server

I am looking for an approach to create a java application for web socket. This application should not use any server's jars.

I say this because I have seen that java client for web sockets are available only for server to server communication. If I need to create it outside the server I have no other go to get those server's jars imported inside.

Upvotes: 0

Views: 433

Answers (4)

Takahiko Kawasaki
Takahiko Kawasaki

Reputation: 19011

nv-websocket-client is a new WebSocket client library written in Java. It requires just Java SE 1.5, so it can run even on Android. The size of nv-websocket-client-1.3.jar (released on 2015-05-06) is 62,854 bytes and it does not require any external dependencies. See "WebSocket client library (Java SE 1.5+, Android)" for details.

Upvotes: 3

Davide Lorenzo MARINO
Davide Lorenzo MARINO

Reputation: 26926

To build a socket application you need only a server part where you instantiate a java.net.ServerSocket and a client part where you instantiate a java.net.Socket.

To do that is not necessary any special library. Those are standard java applications (with a public static void main(String[] args) method) so you don't need a server environment (servlet container or Java EE container).

Upvotes: 0

Scott Stensland
Scott Stensland

Reputation: 28285

You are asking for java, however I suggest you cast your net wider and dive into using Node.js (javascript) as your web socket client/server ... nodejs applications run outside the browser and offer super fast asynchronous networking using the V8 c++ javascript engine ... the same engine which lives at the heart of google's chrome browser ... think of it as the JVM for javascript ... you write javascript yet it executes at c++ speeds

Upvotes: 0

Jake C.
Jake C.

Reputation: 287

I'm not sure I understand your question completely but from what I can gather of your question you might want to look into just plain old sockets. It uses a simple tcp protocol to talk between Java applications and is supported natively in Java take a look at this example (http://cs.lmu.edu/~ray/notes/javanetexamples/). Another alternative for server to server communication is to use something like RabbitMQ (http://www.rabbitmq.com/) or Kafka (http://kafka.apache.org/) but those require much more setup and are more complex then sockets.

Upvotes: 0

Related Questions