direct client-to-client message
Asked Answered
B

5

5

I have been working with node.js for a while, now when I'm looking deeper into it, for a chat aplication instead of sending message as client - server - client, there must be some possible ways for direct client to client message sending?

Balinese answered 14/11, 2012 at 12:34 Comment(4)
Are you find a WebSockets? socket.io caniuse.com/#feat=websocketsNeoterism
@Neoterism the way of socket.io sending message is through a server to a client, dont know if its possible to use socket.io between clients onlyBalinese
possible duplicate of #1032506Unfailing
I am looking for same kind of question #53809999Storehouse
M
5

Browsers tend to communicate with servers via HTTP. Some implement other protocols, like websockets & SPDY, but again, these are mostly client-server protocols.

Some plug-ins (like Flash & Java) can open ports and communicate client-client. (AFAIK, haven't actually used them.)

Chrome is the only browser I'm aware of that can (soon) open TCP and UDP sockets from Javascript and do direct client-client communication. At the moment normal web apps can't do this, your app needs to be run as a "Chrome Packaged App", with a special manifest file.

Here are the docs, a blog post describing the feature and a browserify module that can behave like the net node.js module in the browser.

EDIT: This should probably not be tagged as [node.js] since you're trying to run in browsers (not in your node vm), this is a Javascript / Browser question.

Maxia answered 14/11, 2012 at 13:44 Comment(3)
thanks for replying! So if my server is overloaded with clients therefor my first thought was sending message between clients only, seems this is not a go, would u suggest any other solution or work around?Balinese
Move as much logic as possible out of the server / split it up into multiple components that can run on multiple machines. node.js should be able to handle many many socket.io clients at the same time, do you have more?Maxia
For people reading this after 2016, SPDY is now deprecated. Google removed SPDY support in Google Chrome 51. Mozilla removed it in Firefox 50.[8] Apple has deprecated the technology in macOS 10.14.4 and iOS 12.2.Xanthe
P
2

This is maybe out of date question, but take a look on PeerJS.

It requires server only as a connection manager (broker). But all communication is done between clients directly.

Purree answered 8/5, 2017 at 21:55 Comment(0)
A
1

This does not have anything with server. If you need something like that and if clients are flash you can use RTMFP . For JS i google this library which is js bridge for RTMFP, I dont know how it works. At the end you can write you own library to chat beetween clients but this is much harder(IP addresses are behind NAT, etc...)

Airspeed answered 14/11, 2012 at 12:47 Comment(4)
how come it does nothing with server? the server has to start a client, and when a 2nd client is started, there should be a way of sending message between the two clients onlyBalinese
Sorry, I didnt ment initial chat does not require server, but chat between two clients later(if you do not want to go through server) does not. Maybe I wasnt clear enough. Anyway if you are able to use flash/flex then go out with RTMFP. Chat roulette is made that wayAirspeed
ty for cleaning up, so what u suggest is about real time IO if I didnt missunderstand? Then do you know about nowjs github.com/Flotype/now ? Maybe its a solution too?Balinese
That doesnt look to me like valid pear to pear socket library, it looks like some kind of framework based on express and I suppose it is meant for rapid web application developing. Communication clinet-server and client-client is very different because, for start, client always knows server IP addressAirspeed
N
0

I think answer for your question is here

PS Also exist open-source in-browser server which written using JS, but I didn't google it quickly. If you find it, please notify me.

Neoterism answered 14/11, 2012 at 16:8 Comment(0)
N
0

If you just don't want to write your own server you can use:

https://httprelay.io

Use AJAX calls to communicate between peers.

Nicholenicholl answered 24/4, 2017 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.