need new feature: peer.socket.send #1024
szcuipeng
started this conversation in
Ideas & Feature requests
Replies: 2 comments 3 replies
-
|
Hey @szcuipeng. If you listen to the const server = PeerServer(opts, (server) => {
...
});
server.on("connection", (client) => {
client.getSocket()?.send("Hello");
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
now in client side: let peer = new Peer ( "custom_peer_id" );
peer.on("open",function(peer_id){
peer._socket._socket.send("json data");
});i'd like to having this: peer.getSocket().send("json data");
//and:
peer.on("data",function(data){
console.log("return from peer server websocket: ",data);
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i found peer ( for example: peer = new Peer) owns a websocket connect to peer server, and see the following link:
https://github.com/peers/peerjs-server#combining-with-existing-express-app
the peer server can handle socket request.
right?
then can peerjs provide socket send request/handler response method?
any advices will be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions