flocked翻译_physicked翻译

flocked翻译_physicked翻译FleckisaWebSocketserverimplementationinC#.BranchedfromtheNuggetproject,Fleckrequiresnoinheritance,container,oradditionalreferences.ExampleThefollowingisanexamplethatwillecho…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

Fleck is a WebSocket server implementation in C#. Branched from the Nugget 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://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

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 theWebSocketServer.SupportedSubProtocolsproperty. 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.

var server = new WebSocketServer(“ws://0.0.0.0:8181”);

server.SupportedSubProtocols = new []{ “superchat”, “chat” };

server.Start(socket =>

{

//socket.ConnectionInfo.NegotiatedSubProtocol is populated

});

Custom Logging

Fleck can log into Log4Net or any other third party logging system. Just override the FleckLog.LogAction property with the desired behavior.

ILog logger = LogManager.GetLogger(typeof(FleckLog));

FleckLog.LogAction = (level, message, ex) => {

switch(level) {

case LogLevel.Debug:

logger.Debug(message, ex);

break;

case LogLevel.Error:

logger.Error(message, ex);

break;

case LogLevel.Warn:

logger.Warn(message, ex);

break;

default:

logger.Info(message, ex);

break;

}

};

Disable Nagle’s Algorithm

Set NoDelay to true on the WebSocketConnection.ListenerSocket

var server = new WebSocketServer(“ws://0.0.0.0:8181”);

server.ListenerSocket.NoDelay = true;

server.Start(socket =>

{

//Child connections will not use Nagle’s Algorithm

});

Auto Restart After Listen Error

Set RestartAfterListenError to true on the WebSocketConnection

var server = new WebSocketServer(“ws://0.0.0.0:8181”);

server.RestartAfterListenError = true;

server.Start(socket =>

{

//…use as normal

});

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/227252.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • android 小米pad 调试,小米平板2 开启USB调试模式「建议收藏」

    android 小米pad 调试,小米平板2 开启USB调试模式「建议收藏」我们要将小米平板2与电脑进行连接,就必须要打开小米平板2系统的调试模式,不同的系统版本打开调试模式的方法有所不同,在这里我们就谈谈小米平板2各种系统版本打开USB调试模式的方法。1、针对Android2.1-2.2版本的系统:我们在桌面按小米平板2手机上的“菜单键”会弹出菜单,点击“设置”选项进入系统的设置菜单列表,然后进入“应用程序”—“开发”,就可以看到“USB调试”选项,我们勾选即可…

    2022年9月13日
    2
  • Activity工作流学习总结

    Activity工作流学习总结1.概念工作流(Workflow),就是“业务过程的部分或整体在计算机应用环境下的自动化”,它主要解决的是“使在多个参与者之间按照某种预定义的规则传递文档、信息或任务的过程自动进行,从而实现某个预期的业务目标,或者促使此目标的实现”。2.Activity介绍Activiti5是由Alfresco软件在2010年5月17日发布的业务流程管理(BPM)框架,它是覆盖了业务流程管理、工作流、…

    2022年5月3日
    44
  • vue中父组件向子组件传值

    vue中父组件向子组件传值首先在以下案例中,App.vue是父组件,Second-module.vue是子组件。总体来说,父传子就是这四个步骤:父组件的data中定义值,引入并调用子组件,在引用的子组件的标签上通过v-bind指令给子组件传值,子组件通过在data中定义的props属性接收父组件传过来的值然后应用到子组件里。首先,值肯定是定义在父组件中的,供所有子组件共享,所以要在父组件的data中定义值:…

    2022年6月5日
    35
  • sourceinsight激活码3.5_pdf注册码及序列号

    sourceinsight激活码3.5_pdf注册码及序列号SI3US-032434-64929

    2022年9月27日
    5
  • python三种基本数据类型有哪些_python中有哪些基本数据类型

    python三种基本数据类型有哪些_python中有哪些基本数据类型python的基本数据类型有哪些?下面一一给大家介绍:1、数字—>int类当然对于数字,Python的数字类型有int整型、long长整型、float浮点数、complex复数、以及布尔值(0和1),这里只针对int整型进行介绍学习。在Python2中,整数的大小是有限制的,即当数字超过一定的范围不再是int类型,而是long长整型,而在Python3中,无论整数的大小长度为多少,…

    2022年5月7日
    77
  • mysql sql常用语句大全「建议收藏」

    mysql sql常用语句大全「建议收藏」一、常用操作数据库的命令1.showdatabases;查看所有的数据库2.createdatabasetest;创建一个叫test的数据库3.dropdatabasetest;删除一个叫test的数据库4.usetest;选中库,在建表之前必须要选择数据库5.showtables;在选中的数据库之中查看所有的表6.createtable表名(字段1…

    2022年4月29日
    55

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号