用于unity3d的socket.io客户端 UnitySocketIO

码农软件 · 软件分类 · 服务框架/平台 · 2019-09-25 19:59:57

软件介绍

UnitySocketIO是一款基于socketio4net.Client用C#语言编写unity3dsocket.io客户端。

而,socketio4net.Client只是提供了一个与unity3d兼容的.NET 4.0 C#的客户端我们一直在努力使它支持unity3d

项目最初设计为pomelo框架的统一客户端,它是一个强大的,可扩展的游戏服务器框架

使用方法

使用UnitySocketIO非常简单。只需要将位于/ bin/Debug/文件夹中所有DLL复制到您的项目中

当然,你可以下载这个项目并编译:

复制git https://github.com/NetEase/UnitySocketIO.git

API

创建并初始化一个新的UnitySocketIO客户端。

Client client = new Client(url);
client.Opened += SocketOpened;
client.Message += SocketMessage;
client.SocketConnectionClosed += SocketConnectionClosed;
client.Error +=SocketError;
client.Connect();private void SocketOpened(object sender, MessageEventArgs e) {    //invoke when socket opened}

发送信息到服务器。

client.Send(messge);

从服务器获取信息

private void SocketMessage (object sender, MessageEventArgs e) {    
    if ( e!= null && e.Message.Event == "message") {       
        string msg = e.Message.MessageText;
       process(msg);
    }
}

关闭连接。

client.Close();

本文地址:https://www.codercto.com/soft/d/15396.html

Programming the Mobile Web

Programming the Mobile Web

Maximiliano Firtman / O'Reilly Media / 2010-07-23 / $44.99

* Learn how to use your existing skills to move into mobile web development * Discover the new possibilities of mobile web development, and understand its limitations * Get detailed coverage of ......一起来看看 《Programming the Mobile Web》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具