資源簡介
實現nodejs服務器 與C# form 間socket 響應
代碼片段和文件信息
using?System;
using?System.Collections.Concurrent;
using?System.Collections.Generic;
using?System.Diagnostics;
using?System.Linq;
using?System.Net;
using?System.Threading;
using?System.Threading.Tasks;
using?Newtonsoft.Json;
using?SocketIOClient.Eventing;
using?SocketIOClient.Messages;
using?WebSocket4Net;
namespace?SocketIOClient
{
///?
///?Class?to?emulate?socket.io?javascript?client?capabilities?for?.net?classes
///?
///?Connection?for?wss?or?https?urls ??
public?class?Client?:?IDisposable?SocketIOClient.IClient
{
private?Timer?socketHeartBeatTimer;?//?HeartBeat?timer?
private?Task?dequeuOutBoundMsgTask;
private?BlockingCollection?outboundQueue;
private?int?retryConnectionCount?=?0;
private?int?retryConnectionAttempts?=?3;
private?readonly?static?object?padLock?=?new?object();?//?allow?one?connection?attempt?at?a?time
///?
///?Uri?of?Websocket?server
///?
protected?Uri?uri;
///?
///?Underlying?WebSocket?implementation
///?
protected?WebSocket?wsClient;
///?
///?RegistrationManager?for?dynamic?events
///?
protected?RegistrationManager?registrationManager;??//?allow?registration?of?dynamic?events?(event?names)?for?client?actions
///?
///?By?Default?use?WebSocketVersion.Rfc6455
///?
protected?WebSocketVersion?socketVersion?=?WebSocketVersion.Rfc6455;
//?Events
///?
///?Opened?event?comes?from?the?underlying?websocket?client?connection?being?opened.??This?is?not?the?same?as?socket.io?returning?the?‘connect‘?event
///?
public?event?EventHandler?Opened;
public?event?EventHandler?Message;
public?event?EventHandler?ConnectionRetryAttempt;
public?event?EventHandler?HeartBeatTimerEvent;
///?
///?The?underlying?websocket?connection?has?closed?(unexpectedly)
///?The?Socket.IO?service?may?have?closed?the?connection?due?to?a?heartbeat?timeout?or?the?connection?was?just?broken
///?Call?the?client.Connect()?method?to?re-establish?the?connection
///?
public?event?EventHandler?SocketConnectionClosed;
public?event?EventHandler?Error;
///?
///?ResetEvent?for?Outbound?MessageQueue?Empty?Event?-?all?pending?messages?have?been?sent
///?
public?ManualResetEvent?MessageQueueEmptyEvent?=?new?ManualResetEvent(true);
///?
///?Connection?Open?Event
///?
public?ManualResetEvent?ConnectionOpenEvent?=?new?ManualResetEvent(false);
///?
///?Number?of?reconnection?attempts?before?raising?SocketConnectionClosed?event?-?(default?=?3)
///?
public?int?RetryConnectionAttempts
{
get?{?return?this.retryConnectionAttempts;?}
set?{?this.retryConnectionAttempts?=?value;?}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????35840??2014-03-12?14:08??socketio4net\bin\debug\SocketIOClient.dll
?????文件???????1266??2014-03-12?14:08??socketio4net\bin\debug\SocketIOClient.dll.CodeAnalysisLog.xm
?????文件??????????0??2014-03-12?14:08??socketio4net\bin\debug\SocketIOClient.dll.lastcodeanalysissucceeded
?????文件??????87552??2014-03-12?14:08??socketio4net\bin\debug\SocketIOClient.pdb
?????文件??????14136??2014-03-12?14:08??socketio4net\bin\debug\SocketIOClient.xm
?????文件?????101888??2012-06-18?10:42??socketio4net\bin\debug\WebSocket4Net.dll
?????文件?????142848??2012-06-18?10:41??socketio4net\bin\debug\WebSocket4Net.pdb
?????文件????????278??2014-03-03?14:15??socketio4net\NodeJS\node_modules\.bin\express
?????文件????????139??2014-03-03?14:15??socketio4net\NodeJS\node_modules\.bin\express.cmd
?????文件??????????0??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\.gitmodules
?????文件?????????62??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\.npmignore
?????文件?????????69??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\.travis.yml
?????文件????????326??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\benchmark.js
?????文件??????13367??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\ejs.js
?????文件???????7635??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\ejs.min.js
?????文件????????588??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\examples\client.html
?????文件????????183??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\examples\functions.ejs
?????文件????????433??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\examples\functions.js
?????文件????????152??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\examples\list.ejs
?????文件????????224??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\examples\list.js
?????文件???????2696??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\History.md
?????文件?????????39??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\index.js
?????文件???????8381??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\lib\ejs.js
?????文件???????3101??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\lib\filters.js
?????文件????????419??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\lib\utils.js
?????文件????????337??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\Makefile
?????文件???????6102??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\package.json
?????文件???????5045??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\Readme.md
?????文件???????3822??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\support\compile.js
?????文件???????8987??2014-03-03?14:14??socketio4net\NodeJS\node_modules\ejs\test\ejs.js
............此處省略1310個文件信息
- 上一篇:淘淘汽配網上商城項目
- 下一篇:個人財務管理系統(tǒng)的設計與實現源碼C#
評論
共有 條評論