Open nsmith1024 opened 3 years ago
server.Start(socket =>
{
var connectionInfo = socket.ConnectionInfo; <--- All info you can get
socket.OnOpen = () => OnOpen(connectionInfo);
socket.OnClose = () => Console.WriteLine("Close!");
socket.OnMessage = message => socket.Send("You said: " + message);
});
Hello,
Im upgrading my old C# server code from using regular TCP Sockets, to using your secure WebSocket (wss://)
My old code looks like this
TcpListener serverSocket; .... TcpClient client = serverSocket.AcceptTcpClient(); Stream stream = new SslStream(client.GetStream(), false);
My old code uses "client" and "stream" variables from above in literally a million places. So im wondering if your WebSocket class has some equivalent to theses so that i dont have to rewrite all my code? Im starting off using your example like this below
var server = new WebSocketServer("wss://0.0.0.0:8431"); server.Certificate = new X509Certificate2("MyCert.pfx"); server.Start(socket => { TclClient client=socket.client; <---- Do you have this?? Stream stream=socket.stream; <---- Do you have this??? // send and receive on the stream });
Do you have a way where i can obtain the TcpClient and Stream from your "socket" iWebSocketConnection variable above?
Thanks