Project Description

SocketIO4Net.Client

Update as of 11/02/2013

A develop branch is up at https://github.com/jstott/socketio4net/tree/develop for anyone looking to take an early peek.  Xhr-polling and websockets are working from the C# client.  Thank to the efforts from one of our users Nick, this feature is just about there!

Of particular interest, I'm looking for feedback on the .net 40 assembly types (client, PCL etc...) most interested in.  The plan is to release a both .net v4.0 & v4.5, using native .net websockets in v4.5 vs websocket4net currenlty in v4.0.

SocketI04net v4.0 is now leveraging the Microsoft.BCL.Async library (includes Microsoft.BCL.Build, Http packs) - please let me know if that create any additional issues.

Nuget packages are not available (yet), but after some additional testing and release notes will create a pre-release version for the latest code.

Please continue to leave discussions here, and if you have/see any issues with the latest develop code on github, please log there.

Jim

NuGet updated to v06.26

Project Description

SocketIO4Net.Client provides a .NET 4.0 C# client for Socket.IO.  It provides an overall interface similar to the client JavaScript experience, leveraging the WebSocket4Net project for an underlying websocket implementation.

My goal for this project is a simple & familiar experience for .net clients.  You know you want your .Net app to join in some of the fun, right?  Besides, all the cool kids are using Nodejs and Socket.IO these days anyway, give it a whirl.

This resulting signature is very similar to the socket.io javascript counterpart:

node.js / JavaScript client

socket.on('news', function (data) {
console.log(data);
});

C# .net client

socket.On("news", (data) =>    {
Console.WriteLine(data);
});

The all important - Sample / Demo code snippet 

Client socket;
public void Execute()
{
Console.WriteLine("Starting TestSocketIOClient Example..."); socket = new Client("http://127.0.0.1:3000/"); // url to nodejs
socket.Opened += SocketOpened;
socket.Message += SocketMessage;
socket.SocketConnectionClosed += SocketConnectionClosed;
socket.Error += SocketError; // register for 'connect' event with io server
socket.On("connect", (fn) =>
{
Console.WriteLine("\r\nConnected event...\r\n");
Console.WriteLine("Emit Part object"); // emit Json Serializable object, anonymous types, or strings
Part newPart = new Part()
{ PartNumber = "K4P2G324EC", Code = "DDR2", Level = 1 };
socket.Emit("partInfo", newPart);
}); // register for 'update' events - message is a json 'Part' object
socket.On("update", (data) =>
{
Console.WriteLine("recv [socket].[update] event");
//Console.WriteLine(" raw message: {0}", data.RawMessage);
//Console.WriteLine(" string message: {0}", data.MessageText);
//Console.WriteLine(" json data string: {0}", data.Json.ToJsonString());
//Console.WriteLine(" json raw: {0}", data.Json.Args[0]); // cast message as Part - use type cast helper
Part part = data.Json.GetFirstArgAs<Part>();
Console.WriteLine(" Part Level: {0}\r\n", part.Level);
}); // make the socket.io connection
socket.Connect();
}

Getting Started

Two ways to get started:

  1. Download source code, compile, and run the included Test & Sample code and have a look around.
  2. Install via Nuget – run the following command in the Package Manager Console >  Install-Package SocketIO4Net.Client

See the Documentation section for further details.

SocketIO4Net.Client的更多相关文章

  1. nodejs即时通讯模块+SocketIO4Net的使用小结

    实现思路:客户端js连接了nodejs服务,通过.net连接nodejs服务,通过.net发送消息到nodejs,然后通过nodejs将消息推送给(用户)客户端 1.先下载nodejs安装,至于怎么安 ...

  2. vmware里面的名词 vSphere、vCenter Server、ESXI、vSphere Client

    vmware里面的名词 vSphere.vCenter Server.ESXI.vSphere Client vSphere.vCenter Server.ESXI.vSphere Client VS ...

  3. Apache2.4:AH01630 client denied by server configuration

    问题说明:Apache服务总共有4个,是为了防止单点故障和负载均衡,负载均衡控制由局方的F5提供. 访问的内容在NAS存储上,现象是直接访问每个apache的服务内容都是没有问题,但是从负载地址过来的 ...

  4. [异常解决] windows用SSH和linux同步文件&linux开启SSH&ssh client 报 algorithm negotiation failed的解决方法之一

    1.安装.配置与启动 SSH分客户端openssh-client和openssh-server 如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有 ...

  5. xamarin IOS 报错处理: an error occurred on client Build420719 while

    xamarin IOS 开发时如果报错如下: an error occurred on client Build420719 while...... 出现如下问题时,可能是1.丢失文件2.没有包括在项 ...

  6. ASP.NET OAuth:access token的加密解密,client secret与refresh token的生成

    在 ASP.NET OWIN OAuth(Microsoft.Owin.Security.OAuth)中,access token 的默认加密方法是: 1) System.Security.Crypt ...

  7. 在ASP.NET中基于Owin OAuth使用Client Credentials Grant授权发放Token

    OAuth真是一个复杂的东东,即使你把OAuth规范倒背如流,在具体实现时也会无从下手.因此,Microsoft.Owin.Security.OAuth应运而生(它的实现代码在Katana项目中),帮 ...

  8. [OAuth]基于DotNetOpenAuth实现Client Credentials Grant

    Client Credentials Grant是指直接由Client向Authorization Server请求access token,无需用户(Resource Owner)的授权.比如我们提 ...

  9. OData Client Code Generator

    转发. [Tutorial & Sample] How to use OData Client Code Generator to generate client-side proxy cla ...

随机推荐

  1. (Gorails)vuejs系列视频: Webpacker/vue-resource(不再为官方推荐)。

    频:https://gorails.com/episodes/using-vuejs-for-nested-forms-part-1?autoplay=1 在嵌套表格上使用vue.js. 在appli ...

  2. 3-5 回顾,快速二分法的疑点解惑:为啥先右j移动?因为设定a[left]为基准点

    快速二分法的疑点解惑:为啥先右j移动?因为设定a[left]为基准数 , 1] [91, 86, 42, 46, 9, 68, 77, 46, 7, 1] [91, 86, 42, 46, 9, 68 ...

  3. 1月5日 对象Object, 含过去看的英文档的总结链接

    Object 也是一种数据类型,可以有属性,有method. 反之,在Ruby中,每一种数据类型都是Object.如String,Integer,Float,Array,Hash. IN Ruby e ...

  4. UVA-1220 Party at Hali-Bula (树的最大独立集)

    题目大意:数的最大独立集问题.特殊在要求回答答案是否唯一. 题目分析:定义状态dp(i,1),dp(i,0)分别表示以i为根节点的子树选不选i最多可选的人数,f(i,1),f(i,0)分别表示以i为根 ...

  5. OAF Sample Code(转)

    原文地址: OAF Sample Code

  6. Windows系统配置Python环境,python2和python3共存

      Windows系统配置python2和python3共存   1.下载python: https://www.python.org/downloads/ 注:选择需要的版本(python2 or ...

  7. Vue--Vue.nextTick()的使用

    Vue.nextTick()是比较常用到的API Vue官网对它的解释是:在下次 DOM 更新循环结束之后执行延迟回调.在修改数据之后立即使用这个方法,获取更新后的 DOM. 首先要明白Vue的响应式 ...

  8. Flask初级(十一)flash与APScheduler 实现定时任务

    from flask import Flask from flask_apscheduler import APScheduler # 引入APScheduler class Config(objec ...

  9. static 关键字介绍

    大家都知道,我们可以基于一个类创建多个该类的对象,每个对象都拥有自己的成员,互相独立.然而在某些时候,我们更希望该类所有的对象共享同一个成员.此时就是 static 大显身手的时候了!! Java 中 ...

  10. Socket缓冲区

    1.由于可读状态是在对方写入数据后或socket关闭时才能出现,因此如果客户端和服务端都停留在read时,如果没有任何一方,向对方写入数据,这将会产生一个死锁. 2.此外,在本地接收操作发起之前,很可 ...