javascript - Porting node.js server-side code to HTML5 WebSockets -


note: not using both node.js , html5 sockets. i'm not interested in discussing merits of setup i'm describing.

node.js runs on server, and, since supports connecting via sockets as client, can act middle layer between html5/js client , server uses tcp/ip (such database server.) so, both node.js , websockets include ways of opening socket connections server.

my question is, has ported node.js script websockets, i.e., cut node.js out of equation, web browser connects database directly? imagine like:

  1. cut out http
  2. port usage of node.js-specific functions use websockets api

if has been done, lot of trouble or node.js , websockets apis relatively similar?

your question bit hard parse i'll take stab.

if interested in connecting websockets client (browser) arbitrary tcp socket server, might interesting in wsproxy generic websockets tcp sockets proxy. wsproxy included novnc (html5 vnc client) , has 3 reference implementations in c, python , node (node.js).

if interested in adding websockets support specific given server (i.e. database server), might find this fork of libvncserver. has support clients speak websockets (i.e. novnc) no proxy needed.

the basic wsproxy proxying functionality pretty straight forwards implement. trickiest part current websockets draft in use (v76) not specify binary transfer payload (only utf-8) wsproxy base64 encodes/decodes traffic to/from websockets client. implementation of websockets connections in libvncserver more tricky because libvncserver has pretty hard-coded ideas buffering/framing needed worked around.

disclaimer: i'm responsible novnc, wsproxy , websockets patches libvncserver.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -