PHP websocket Issues
WebSocket service End with PHP, check for a long time Baidu, all is the client to send the message passive push, the server actively push how to do it, manual all in English.
To realize customer service and customer chat ideas how to do it (the client is H5, customer service is a PC, customer service answer how to call WebSocket server, and how to push to the corresponding customer service side), I hope the actual project experience of the predecessor informed.
Is it possible to initialize the user identity parameters directly while the client is connected?
function link(){ var url='ws://www.test.com:8000'; socket=new WebSocket(url); socket.onopen=function(){ var json = JSON.stringify({'userid':'1001'});//怎么标注身份 socket.send(json); } socket.onmessage=function(msg){} socket.onclose=function(){}}
I feel that this kind of thinking is wrong from the start, and today only began to contact such problems, but also hope that experienced predecessors informed.
Reply content:
PHP websocket Issues
WebSocket service End with PHP, check for a long time Baidu, all is the client to send the message passive push, the server actively push how to do it, manual all in English.
To realize customer service and customer chat ideas how to do it (the client is H5, customer service is a PC, customer service answer how to call WebSocket server, and how to push to the corresponding customer service side), I hope the actual project experience of the predecessor informed.
Is it possible to initialize the user identity parameters directly while the client is connected?
function link(){ var url='ws://www.test.com:8000'; socket=new WebSocket(url); socket.onopen=function(){ var json = JSON.stringify({'userid':'1001'});//怎么标注身份 socket.send(json); } socket.onmessage=function(msg){} socket.onclose=function(){}}
I feel that this kind of thinking is wrong from the start, and today only began to contact such problems, but also hope that experienced predecessors informed.
Http://www.workerman.net/workerman-chat
Can look at this, php written websocket chat room, customer service function can actually be used inside the single chat function. Someone uses it to implement a passer-by, including web pages and client software.
Development manual: Http://workerman.net/gatewaydoc/
demo:http://chat.workerman.net/
Phpwebim is the Swoole official WebSocket Web Instant Chat tool based on the PHP swoole extension and swoole framework development.
Phpwebim supports Websocket+comet two protocols that can be used for all kinds of browsers including IE.
Https://github.com/matyhtf/PHPWebIM
demo:http://webim.swoole.com/
Technical problems do not check what Baidu,?
I've used the WebSocket in Java. Probably the idea is that the client and server build WebSocket, and then the server side will this logo and this link to save the hashmap inside. When the message needs to be pushed through the identity (which the server provides to the client) to find the appropriate link, and then push the message past. These include some details of what the heartbeat detects. The general idea is this.