简体   繁体   中英

Server WebSockets and server http with node.js

All I am developing an application which needs to communicate with WebSockets with customers online in the browser. For this I started with Node.js to create the server, so far so good, my problem is that there is another application that must communicate via http POST to my server then passes this information to my server my server passes to clients web. I am new to the use of this technology so I apologize if I say nonsense.

1 - I can send a POST request to my server WebSocket, the application that connects customers via WebSocket, Server, may also receive the POST request and send this information to each client by ws?

2 - There is a way to open a client socket with a tag that allows me, server, send information to that client only and not at all, depending on a parameter. I want to know that each socket belongs to a specific customer and only send information to that client.

1.) If I understand you correctly then you want to broadcast information through websockets to other clients. Just take a look at the node.js modules socket.io or ws.

2.) You want to open different sockets for different urls? Like a separate websocket connection for /foo/a/bar and /foo/b/bar? Have a look at my answer here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM