-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WebSocketContext class #263
Conversation
…ocket and networkstream for websocketserver
…cketContext now removes all ties with HttpListner Everything Internal, only visible for System.Net.Websocket
….Http into nanoframework-develop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@Feiko thank you again for your contribution! 🙏😄 .NET nanoFramework it's all about community involvement and no contribution is too small. Please edit it and add an entry with your GitHub user in the appropriate location (names sorted alphabetically):
(feel free to adjust your name, if it's not correct) |
Description
Added internal class WebsocketContext exposing Headers, Socket and networkStream to only Friend System.Net.Websocket.
The WebsocketContext is created by calling HttpListnerContext.GetWebsocketContext().
Calling GetWebsocketContext also will also gracefully remove all references from HttpListner to the underlying Socket and NetworkStream without closing them. From this point it's up to the WebsocketServer to deal with the socket and networkstream.
Some properties had to be set from private to itnernal to make sure that GetWEbsocketContext() was able to gracefully remove all references and remove all resources from HttpListner. This does not expose anything to the outside except for System.Net.Websocket which is regarded as a Friend.
Motivation and Context
This will allow WebSocketServer to directly use HttpListnerContext to build up a websocket connection. This fixes the problem where you would have the websocketserver listening on one port and a HttpListner for serving static website on another port.
How Has This Been Tested?
Tested with browser and updated local websocketserver.
Screenshots
Types of changes
Checklist: