SuperSocket.WebSocket WebSocketServer 设置文本编码
SuperSocket.WebSocket WebSocketServer 设置文本编码
SuperSocket.WebSocket WebSocketServer 置文本编码
public bool initWebSocketServer()
{
var serverConfig = new SuperSocket.SocketBase.Config.ServerConfig();
serverConfig.Port = mWebSocketPort;
serverConfig.TextEncoding = "utf-8";
mWebSocketServer.NewSessionConnected += wsNewSessionConnected;
mWebSocketServer.NewMessageReceived += wsNewMessageReceived;
mWebSocketServer.NewDataReceived += wsNewDataReceived;
// Setup the appServer
if (!mWebSocketServer.Setup(serverConfig))
{
MessageBox.Show("监听WebSocket失败 mWebSocketPort=" + mWebSocketPort);
Application.Exit();
return false;
}
// Try to start the appServer
if (!mWebSocketServer.Start())
{
MessageBox.Show("启动WebSocket失败 mWebSocketPort=" + mWebSocketPort);
Application.Exit();
return false;
}
return true;
}