node.js - Using an HTTP connection as a simple duplex socket in Node -
say we're on network http allowed, what's simplest way use http
module net
module (tcp) socket/stream? between 2 node servers, i'd able send data using write()
, receive data on('data',...)
@ other end continuously. currently, can write once each end subsequent writes don't seem send.
http in nature uni-directional. best can 2 uni-directional channels, without realtime communication.
you can use server-sent events(eventsource), part of html5 standard. uses http transport messages. should @ websockets similar tcp sockets. offer full-duplex realtime communication. use different websocket protocol, can use same ports http. if websocket not blocked, should use it.
here comparison between 2 : websockets vs. server-sent events/eventsource
Comments
Post a Comment