Reputation: 18788
Ultimately what I would like to to is build a Javascript app that runs in the browser, and is able to communicate to other users running the same Javascript app on other machines within the same network. I've been reading up on and playing around with Websockets and webRTC, but they both require a server at some stage of the connection process. I have also looked at PeerJs and OpenPeer, but they too seem to rely on webRTC which in turn requires an intermediate server to setup the connection.
If the users are not connected to the Internet (or to a network running a local server) it doesn't seem possible to use either of the above techniques, right?
Basically what I'm thinking is this:
Is this possible today? Or is there something being developed that would enable this in the near future?
Upvotes: 1
Views: 2259
Reputation: 3739
I know this is an old question, but in case someone finds it relevant:
Today this is possible using WebRTC, a JavaScrip, peer-to-peer, real-time communication protocol.
A library that's available at the time of writing is PeerJS, which supports most browsers, for now except Safari.
PeerJS handles some of the complicated, behind-the-scenes stuff related to NAT and firewalls so that you can send data between two JavaScript clients.
Upvotes: 1
Reputation: 4883
This is not possible to do directly inside of a browser.
Standard HTTP interaction is based on a request-response model. Web browsers act as the client, sending requests. They are not designed to be able to handle HTTP requests and send responses accordingly, that job belongs to a server.
Upvotes: 1