WebSocket4Net


WebSocket4Net


WebSocket4Net is a .NET websocket client
implementation.


It originated from SuperWebSocket
WebSocket Client. For better developing of the websocket client, it was
separated from SuperWebSocket and was renamed to
WebSocket4Net.

WebSocket4Net will provide websocket client implementation
for many different kinds of runtime:



  • .Net 3.5
  • .Net 4.0
  • Mono
  • Silverlight
  • WindowsPhone
  • Mono for Android
  • MonoTouch


  Windows Phone



It is compatible with many websocket drafts:



  • Hybi-00
  • Hybi-10
  • RFC6455


NuGet Package: http://www.nuget.org/packages/WebSocket4Net



Demo code:



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!");

}




Recommended .NET WebSocket Server


SuperWebSocket -  http://superwebsocket.codeplex.com/



Consult/feature request:


[email protected]


 

 

 

https://github.com/statianzo/Fleck

 

  1. C#95.6%
  2. Ruby4.3%
  3. Shell0.1%

C# Websocket Implementation      Read more

Read-Only access

Latest commit to the master branch

readme.markdown

Fleck

Fleck is a WebSocket server implementation in C#. Branched from theNugget project, Fleck requires no inheritance, container, or additional references.

Example

The following is an example that will echo to a client.

var server = new WebSocketServer("ws://localhost: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

var server = new WebSocketServer("wss://localhost:8431");

server.Certificate = "MyCert.cer";

server.Start(socket =>

  {

    //...use as normal

  });

License

The MIT License

Copyright (c) 2010-2012 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.

 

 

 

------------------------------------------------------------------------------------------

 

 

http://supersocket.codeplex.com/

 


SuperSocket is a light weight, cross platform and extensible
socket application framework. You can use it to build a server side socket
application (like FTP server, SMTP/POP3/IMAP4 server, SIP server, SNMP server,
etc) easily without thinking about how to use socket, how to maintain the socket
connections and how socket works(synchronize/asynchronize).

It is a pure
C# project which is designed to be extended, so it is easy to be integrated to
your existing system. If your systems (like forum/CRM/MIS/HRM/ERP) are developed
in .NET language, you must be able to use SuperSocket to build
your socket application as a part of your current system perfectly.

I
know there are two famous NIO open source frameworks named
"MINA" and "Netty" in Java World which are
used widely by developers. If you want to look for a .NET portion of MINA or
Netty, I suggest you try SuperSocket, although
SuperSocket is not strong like MINA and Netty but it is very
simple and you can use it easily.

The source code of
SuperSocket also include some service implementation samples
which you can follow.


Latest stable release:


SuperSocket 1.4 SP3    http://supersocket.codeplex.com/releases/view/82616


Latest beta release:


SuperSocket 1.5 beta 1    http://supersocket.codeplex.com/releases/view/82807


Features:



  • Very easy to use. You can create a robust socket server only by several
    classes
  • Support Sync and Async communication
    modes. You can change your socket server running mode by only changing
    configuration wihtout any code changes
  • Support custom protocol, no matter your protocol is a command line protocol
    or a binary one. Another open source project SuperWebSocket is built
    upon SuperSocket and take advantage of this custom protocol
    feature of it.
  • Support SSL/TLS encryption automatically
  • Support multiple socket server instances. You can define many socket servers
    on different ports in configuration, SuperSocket can run those
    servers in the same application/service
  • SuperSocket can run as console application and windows
    service. It provide a bat file to install SuperSocket as a
    windows service.
  • Flexible logging strategy which can log most of socket activities
  • Also support UDP socket
  • Support IPv6
  • Support Windows Azure
  • Support running in Unix system (by Mono 2.10 or above
    version)
  • Built-in socket policy server for Flash and Silverlight clients which you
    can use directly


           windows azure



Documentation:




Consult/feature request/paid project customization:


[email protected]


Skype: kerry-jiang


Google+: https://plus.google.com/103256006501871418573/


Author's LinkedIn profile: http://cn.linkedin.com/in/kerryjiang


LinkedIn Group: http://www.linkedin.com/groups/SuperSocket-User-Group-3821247


QQ Group: 135969383

 

 

你可能感兴趣的:(websocket)