Which websocket library to use with Node.js? [closed]

Getting the ball rolling with this community wiki answer. Feel free to edit me with your improvements. ws WebSocket server and client for node.js. One of the fastest libraries if not the fastest one. websocket-node WebSocket server and client for node.js websocket-driver-node WebSocket server and client protocol parser node.js – used in faye-websocket-node faye-websocket-node WebSocket … Read more

javax.websocket client simple example

I’ve found a great example using javax.websocket here: http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html Here the code based on the example linked above: TestApp.java: package testapp; import java.net.URI; import java.net.URISyntaxException; public class TestApp { public static void main(String[] args) { try { // open websocket final WebsocketClientEndpoint clientEndPoint = new WebsocketClientEndpoint(new URI(“wss://real.okcoin.cn:10440/websocket/okcoinapi”)); // add listener clientEndPoint.addMessageHandler(new WebsocketClientEndpoint.MessageHandler() { public void … Read more

WebSocket with SSL

The WebSocket connection starts its life with an HTTP or HTTPS handshake. When the page is accessed through HTTP, you can use WS or WSS (WebSocket secure: WS over TLS) . However, when your page is loaded through HTTPS, you can only use WSS – browsers don’t allow to “downgrade” security.

Websocket server: onopen function on the web socket is never called

Probably it’s an encoding issue. Here’s a working C# server I wrote: class Program { static void Main(string[] args) { var listener = new TcpListener(IPAddress.Loopback, 8181); listener.Start(); using (var client = listener.AcceptTcpClient()) using (var stream = client.GetStream()) using (var reader = new StreamReader(stream)) using (var writer = new StreamWriter(stream)) { writer.WriteLine(“HTTP/1.1 101 Web Socket Protocol … Read more

Ajax vs Socket.io

Many of the generic tradeoffs between webSocket and Ajax are discussed here: websocket vs rest API for real time data? Some tradeoff issues for mobile devices are discussed here: Cordova: Sockets, PushNotifications, or repeatedly polling server? In a nutshell, if your data is primarily server-driven and then needs to be sent out to clients and … Read more

Differences between socket.io and websockets

Misconceptions There are few common misconceptions regarding WebSocket and Socket.IO: The first misconception is that using Socket.IO is significantly easier than using WebSocket which doesn’t seem to be the case. See examples below. The second misconception is that WebSocket is not widely supported in the browsers. See below for more info. The third misconception is … Read more