通过PHP连接到socket.io(nodejs) [英] Connect to socket.io(nodejs) via PHP

查看:499
本文介绍了通过PHP连接到socket.io(nodejs)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过php连接到websocket,发送数据并立即断开连接.无需等待套接字的响应.我使用了 elefant.io ,但是在更新库后无法使用.请告诉我如何通过PHP连接到websocket?

I had a need to connect to websocket via php, send data and immediately disconnect. No need to wait for a response from the socket. I used elefant.io but after updating the library does not work. Please tell me how to connect to websocket via PHP?

推荐答案

我也遇到了此问题.了解了很多结构websocket请求.我为自己编写了一个库,您可以使用它. PHP SocketIO客户端.

I also encountered this problem. Learned a lot of structure websocket requests. I wrote a library for yourself, you can use it.PHP SocketIO Client.

您需要简单的套接字连接到nodejs,并以这种消息格式编写.42["message", "your message"]'要编码为hybi10(或hybi13)并发送到websocket

You need simple socket connect to nodejs, compose in this message format.42["message", "your message"]' To encode to hybi10 (or hybi13) and send to websocket

这篇关于通过PHP连接到socket.io(nodejs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆