c# - 统一WebSocket4Net

标签 c# websocket unity3d

如何通过 WebSocket4Net dll 将 Unity 客户端连接到 php 网络服务器?我 试过这样的例子

using WebSocket4Net;

WebSocket websocket = new WebSocket("ws://localhost:2012/");
websocket.Opened += new EventHandler(websocket_Opened);
websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error);
websocket.Closed += new EventHandler(websocket_Closed);
websocket.MessageReceived += new EventHandler(websocket_MessageReceived);
websocket.Open();

private void websocket_Opened(object sender, EventArgs e)
{
 websocket.Send("Hello World!");
}

没有结果

最佳答案

关于c# - 统一WebSocket4Net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22011495/

相关文章:

c# - 为什么在使用 NET40-NoCaSTLe 时会出现 'Moq.Proxy.CaSTLeProxyFactory' 类型初始化程序异常?

c# - 如何格式化 Visual Studio XML 文档以在 Web 上显示

php - 使用 php 任何 jquery 或 WebSocket 或 node.js 的中央控制计时器

memory-management - 释放内存销毁预制件

c# - 地形地面,城市中的草地和雪地 : Skylines

c# - 如何将图像添加到我的应用程序

ssl - 本地主机上的 Websocket 通过 https ://problems

websocket - 为什么我需要使用 daphne 进行反向代理?

c# - 正确制作 GameObject “attach”?

c# - WinForm 绑定(bind)单选按钮