user1108139
user1108139

Reputation: 1

Establish connection with WebSocket

I begin with this technology. I want to establish a TCP/IP connection with an electronic card that has an IP address (the server's map).

I wonder if the WebSocket allow me to make this connection, knowing that at present my interface communicates with the card through a socket implanted in an applet.

Does anyone know the syntax to connect with WebSocket as a parameter an IP address: 135.120.138.105

Thank you

Upvotes: 0

Views: 849

Answers (2)

kanaka
kanaka

Reputation: 73119

WebSockets are not raw TCP sockets. They have many of the same characteristics (low overhead, persistent, bidirectional, full-duplex) as raw TCP sockets, but they have an initial HTTP-like handshake to implement CORS security and allow easier integration with web servers and existing firewall policies. WebSockets are also message based and have a small header on each frame (2 bytes overhead for small payloads).

You have a couple of options. You can use a program that bridges/proxies between WebSockets and raw TCP sockets such websockify (Disclaimer: I made websockify) or you can implement the server side of the WebSocket protocol in your server.

Upvotes: 1

tinyd
tinyd

Reputation: 952

WebSockets won't work in your case. While they use TCP/IP, WebSockets have a different API that's designed for higher-level messages to be passed between server and client and it requires support on the server as well, so unless the card contains a WebSocket-enabled web server I think you're out of luck and you'll have to continue with your applet-based design.

Upvotes: 0

Related Questions