Comments (4)
Thanks. Makes sense.
Implementing the transfer of ownership if the socket this way is fairly trivial, and it doesn't break anything as far as I can tell. I'll have look at it.
from websocketclientlite.pcl.
Interesting use case.
I'd be happy to take a look at this, but please allow me to ask a question:
You write that you don't know when to dispose of the connected instance socket connection that you're passing to the WebSocket Client. Why not closing/disposing it at the same time as you dispose the WebSocket Client, as that is effectively what would happen if the feature request is implemented? Or am I missing something here?
In any case, a way to implement this would be to introduce a boolean valueHasTransferTcpSocketOwnership
in this constructor:
The HasTransferTcpSocketOwnership
would by default be set to false
but when set to true
would always set the private property _keepTcpClientAlive
to false
:
from websocketclientlite.pcl.
I'd be happy to take a look at this, but please allow me to ask a question:
You write that you don't know when to dispose of the connected instance socket connection that you're passing to the WebSocket Client. Why not closing/disposing it at the same time as you dispose the WebSocket Client, as that is effectively what would happen if the feature request is implemented? Or am I missing something here?
Sure, I hope the following explanation will be clear enough, but if it isn't feel free to ask some follow-up questions.
Anyways, in order to start the connection, we simply need to subscribe to the MessageWebsocketRx instance (but we can only do so once as subscribing multiple times will try to start the connection process multiple times) and to disconnect again, we dispose our subscription, kicking in the that logic in the library and doing the further clean-up/disposal of other relevant resources.
However, in some of my usecases, I need to trigger a restart of the websocket connection. So I call the disconnect logic right before executing the connect logic again.
Given that the disposal of the subscriptions is fire-n-forget, it's very much possible that the closing/disposing of the TcpClient happens before the connection is gracefully shut down, resulting in exceptions being thrown from within the library. (which is the main reason why I created this issue in the first place 🙂 )
As for your proposed solution, that was very much the idea that I had in mind as well so that's completely fine for me.
from websocketclientlite.pcl.
Implemented in release 7.3.
from websocketclientlite.pcl.
Related Issues (20)
- Allow setting HTTP headers for handshake. HOT 1
- Subsequent connections from same client instance fail. HOT 2
- CancellationToken in develop branch HOT 7
- ConnectionTimeout - Slack HOT 24
- Message Size greater than 126 Characters HOT 3
- Disconnecting from server causes exception HOT 4
- TLS Cipher Suite HOT 2
- The BeginWrite method cannot be called when another write operation is pending HOT 6
- Unable to be portable due to System.Reactive.Windows.Threading HOT 2
- Ignore invalid ssl cert fails HOT 2
- Visual Studio 2015 Update 3 with Xamarin HOT 3
- Cannot install nuget package for 4.1.2 in .NET Standard 2.0 project in VS 2017 HOT 1
- Sec-WebSocket-Protocol is aggregated wrong HOT 1
- Doesn't connect with proxy HOT 2
- CreateObservableMessageReceiver TimeOut HOT 1
- Could not load file or assembly ISocketLite.PCL Version=4.2.1.0 HOT 1
- Question : WebsocketClientLite versus the Microsoft client for performance HOT 1
- NuGet package versions 7.0.0 and 7.0.1 actually contain version 6.4.0 HOT 2
- IsConnected always true. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocketclientlite.pcl.