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

});

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • .java编译成.class 与 .class反编译成.java

    .java编译成.class 与 .class反编译成.java.java编译成.class 与 .class反编译成.java

  • 模板阴影理论概述

    模板阴影理论概述尹克雄|2002年12月02日07:30|图形编程与理论阴影 体积 平面 模板 光 前身 图 深度 夹讨论使用模板阴影卷的几种方法,包括每种阴影卷的优点和缺点。介绍阴影以前只是一个变暗的纹理,通常是圆形的形状,它被投射到游戏中的字符或对象之下的地板上。一个人必须不知情或天真地认为,我们仍然可以在未来的3D游戏中摆脱这种粗暴的“

  • python3生成随机数_用python随机输出一个区间的随机数

    python3生成随机数_用python随机输出一个区间的随机数#coding:utf-8″””生成随机数”””importrandomimporttimeimportuuidfromhashlibimportmd5__author__=’zheng’defgenerate_rand_id(sstr=None):”””生成一组16进制的随机数,32位:paramsstr::return:”””ti=int(time.time())if…

  • ipsec linux_linux文件复制命令

    ipsec linux_linux文件复制命令ipset介绍iptables是在linux内核里配置防火墙规则的用户空间工具,它实际上是netfilter框架的一部分.可能因为iptables是netfilter框架里最常见的部分,所以这个框架通常被称为iptables,iptables是linux从2.4版本引入的防火墙解决方案.ipset是iptables的扩展,它允许你创建匹配整个地址sets(地址集合)的规则。而不像普通的ipta…

  • MPLS 虚拟专用网络技术原理与配置

    MPLS 虚拟专用网络技术原理与配置

  • 每天5分钟玩转docker容器技术 pdf_docker 创建容器

    每天5分钟玩转docker容器技术 pdf_docker 创建容器Docker介绍Docker简介和安装Docker是什么为什么使用Docker和普通虚拟机的对比打包、分发、部署小结Docker部署的优势Docker通常用来做什么重要概念:镜像、容器安装Ubuntu安装DockerWindows安装DockerDocker架构镜像加速源Docker命令服务相关命令镜像相关命令容器相关命令数据卷数据卷概念及其作用配置数据卷数据卷容器应用部署部署MySQL部署tomcat部署Nginx部署reids镜像原理容器转为镜像Dockfile案例部署springboot项目自定义ce

发表回复

您的电子邮箱地址不会被公开。

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