valor-software / nativescript-plugins Goto Github PK
View Code? Open in Web Editor NEWnativescript-plugins
License: MIT License
nativescript-plugins
License: MIT License
Hi, how to pass header websocket plugin?
Hi there and thanks for your work.
I opened this to describe a very strange behaviour of the nativescript-websockets plugin where i cannot really explain what and where the bug lies, but maybe someone here might have the right idea. Or it might point to a bug somewhere in the software stack. Since it is a rather complex scenario i don't know if i can provide a minimal code example.
We use websockets to communicate between a web-app and a nativescript app and xchange data in an encrypted way. There are severeal messages included in a bidirectional way.
After initiating the communication it just stops at some point. Browser and Relay-Server are sending the message but the app just doesn't receive it. There is no error, no timeout, just waiting for the next message.
It mostly stops if a message is not sent immediately, which might happen during the first automatic steps. But it always happens at a message we only sent after human interaction in the browser app. Thus we firstly assumed issues with timeouts, but weren't able to find any timeout which would stop the communication silently. We also don't configure any.
During my attempts to figure out what happens, i noticed the "strange" behaviour mentioned.
I added a subscrption to monitor the socket reference:
interval(1000).subscribe(() => {
console.log("This socket: ", this.socket);
});
But instead of seeing more information about the problem, it just works. oO
I reproduced this several times and also on both platforms: android and ios.
We have a class encapsulating the websocket reference and details of our protocol.
This class also constructs the Socket and is adding the Eventhandlers.
That "floating" subscribtion above is added after creation of the socket.
This behaviour was introduced during upgrades from ns6 to ns8 which also includes switching to this nativescript-websocket-implementation. The ns6 variant works without this behaviour. The typescript code didn't change except for some minor changes due to the upgrade.
As said, i don't really have an idea where this fails, and after days of diggin i fear i never will find one.
I assume that somehow the reference or the thread waiting for the next message gets suspended without waking up anymore or collected or some other stuff which shouldn't happen and that that floating subscription somehow prevents that since it changes how the code is interpreted by the runtime.
For the time i will live with this hack, without sleeping well though.
But as said this might point to other problems in the stack.
Thanks
legion
Please make this plugin support vue
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.