WebsocketCsharp

所属分类:C#编程
开发工具:C#
文件大小:5013KB
下载次数:15
上传日期:2017-06-23 11:18:06
上 传 者安好丶
说明:  一个基于.net的websocket的源代码
(A.net based websocket source code)

文件列表:
Rakefile (3711, 2014-09-09)
VERSION (7, 2014-09-09)
src (0, 2014-09-15)
src\Fleck (0, 2014-09-15)
src\Fleck\bin (0, 2014-09-15)
src\Fleck\bin\Debug (0, 2014-09-15)
src\Fleck\bin\Debug\Fleck.dll (43520, 2014-09-16)
src\Fleck\bin\Debug\Fleck.pdb (120320, 2014-09-16)
src\Fleck\Fleck.csproj (5147, 2014-09-09)
src\Fleck\Fleck.nuspec (520, 2014-09-09)
src\Fleck\FleckLog.cs (1075, 2014-09-09)
src\Fleck\FrameType.cs (204, 2014-09-09)
src\Fleck\HandlerFactory.cs (1364, 2014-09-09)
src\Fleck\Handlers (0, 2014-09-09)
src\Fleck\Handlers\ComposableHandler.cs (1562, 2014-09-09)
src\Fleck\Handlers\Draft76Handler.cs (4601, 2014-09-09)
src\Fleck\Handlers\Hybi13Handler.cs (8437, 2014-09-09)
src\Fleck\HandshakeException.cs (357, 2014-09-09)
src\Fleck\Interfaces (0, 2014-09-09)
src\Fleck\Interfaces\IHandler.cs (417, 2014-09-09)
src\Fleck\Interfaces\ISocket.cs (872, 2014-09-09)
src\Fleck\Interfaces\IWebSocketConnection.cs (677, 2014-09-09)
src\Fleck\Interfaces\IWebSocketConnectionInfo.cs (468, 2014-09-09)
src\Fleck\Interfaces\IWebSocketServer.cs (164, 2014-09-09)
src\Fleck\IntExtensions.cs (1227, 2014-09-09)
src\Fleck\obj (0, 2014-09-15)
src\Fleck\obj\Debug (0, 2014-09-16)
src\Fleck\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache (5124, 2014-09-16)
src\Fleck\obj\Debug\Fleck.csproj.FileListAbsolute.txt (216, 2014-09-15)
src\Fleck\obj\Debug\Fleck.dll (43520, 2014-09-16)
src\Fleck\obj\Debug\Fleck.pdb (120320, 2014-09-16)
src\Fleck\obj\Debug\TempPE (0, 2014-09-15)
src\Fleck\QueuedStream.cs (7559, 2014-09-09)
src\Fleck\ReadState.cs (421, 2014-09-09)
src\Fleck\RequestParser.cs (1663, 2014-09-09)
src\Fleck\SocketWrapper.cs (5687, 2014-09-09)
src\Fleck\SubProtocolNegotiationFailureException.cs (423, 2014-09-09)
src\Fleck\SubProtocolNegotiator.cs (594, 2014-09-09)
... ...

Fleck ![project-status](http://stillmaintained.com/statianzo/Fleck.png?1) === Fleck is a WebSocket server implementation in C#. Branched from the [Nugget][nugget] project, Fleck requires no inheritance, container, or additional references. Example --- The following is an example that will echo to a client. ```c# var server = new WebSocketServer("ws://0.0.0.0:8181"); server.Start(socket => { socket.OnOpen = () => Console.WriteLine("Open!"); socket.OnClose = () => Console.WriteLine("Close!"); socket.OnMessage = message => socket.Send(message); }); ``` Supported WebSocket Versions --- Fleck supports several WebSocket versions of modern web browsers - Hixie-Draft-76/Hybi-00 (Safari 5, Chrome < 14, Firefox 4 (when enabled)) - Hybi-07 (Firefox 6) - Hybi-10 (Chrome 14-16, Firefox 7) - Hybi-13 (Chrome 17+) Secure WebSockets (wss://) --- Enabling secure connections requires two things: using the scheme `wss` instead of `ws`, and pointing Fleck to an x509 certificate containing a public and private key ```cs var server = new WebSocketServer("wss://0.0.0.0:8431"); server.Certificate = new X509Certificate2("MyCert.pfx"); server.Start(socket => { //...use as normal }); ``` SubProtocol Negotiation --- To enable negotiation of subprotocols, specify the supported protocols on the `WebSocketServer.SupportedSubProtocols` property. The negotiated subprotocol will be available on the socket's `ConnectionInfo.NegotiatedSubProtocol`. If no supported subprotocols are found on the client request (the Sec-WebSocket-Protocol header), the connection will be closed. ```cs var server = new WebSocketServer("ws://0.0.0.0:8181"); server.SupportedSubProtocols = new []{ "superchat", "chat" }; server.Start(socket => { //socket.ConnectionInfo.NegotiatedSubProtocol is populated }); ``` License --- The MIT License Copyright (c) 2010-2014 Jason Staten Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [nugget]: http://nugget.codeplex.com/

近期下载者

相关文件


收藏者