-
Notifications
You must be signed in to change notification settings - Fork 96
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
[BUG?] Client not telling server to close, server not detecting "close" event. #34
Comments
is there any NativeWindow events that can help you like "closing"? |
Thanks for the fast response. Yeah, I guess I can listen to the Event.CLOSE event on the NativeWindow and call This is my JavaScript WebSocket client code: const ws = new WebSocket("ws://localhost:3555");
// Register event listeners for the open, close, and message events
ws.onopen = () => {
console.log("WebSocket ready!");
ws.send("Hello World!");
};
ws.onmessage = (message) => {
console.log("Received data:", message.data);
};
ws.onclose = () => console.log("WebSocket closed!");
ws.onerror = (err) => console.log("WebSocket error:", err.error); See? I'm not handling any UI event on the HTML window when it "closes", and the Javascript WebSocket class still let the server know that the client is not connected anymore. So I think this may be a bug in the AS3WebSocket library. I never had issues with these events in any other language like Dart or Python. All the events are dispatched correctly. Also, using the Socket class in AS3 and using a non WebSocket server in NodeJS for example, all events dispatch correctly too. |
First of all, how do you use the AS3 websocket if it's not in an AIR app? |
Whoa.... people are still using this? I'm genuinely surprised, given that Flash is pretty much dead! |
I developed this library for a browser-based web app, and haven't ever tested it in an Air context on Android, so I'm not really familiar with these NativeWindow events you're talking about, but watching for them and then manually closing any open connections sounds likely to be the right approach with least effort. You could fork and update the library if you want to hook into those things under the hood. I'll accept a PR if you do, but I am generally considering this library to be obsolete and unsupported at this point. |
I get your irony. I'm aware Flash Player died, so no more Flash Player on the web. I was just being specific about my environment to have a better clue at what's happening. I know it's Event.CLOSING, it was just a typo for all the times I've wrote the word "close". I was just having a nostalgia moment, trying Deno for the first time, and decided to use an AIR app as the client to test it. Although, there are still many AS3/AIR developers out there using the AIR SDK that Harman owned from Adobe. But I didn't intend to turn this thread in a debate about AS3/AIR/Flash obsoleteness. Just wanted to know why this AS3WebSocket lib isn't telling the server that it disconnected when closing the NativeWindow. Cheers. Stay safe. |
nothing is dead on computer, it's just an illusion for the sheep following the matrix... |
Can you please guys give me a hand here?
ryo-ma/deno-websocket#16
My Deno WebSocketServer dispatches the "close" event with the Javascript built-in WebSocket when I close the HTML page.
But not with the AS3WebSocket lib when I close the NativeWindow. I even tried listening to the NativeProcessErrorEvent.ERROR event and force the websocket to close manually. The other events dispatch ok (new message and new client connection).
Thanks, cheers.
The text was updated successfully, but these errors were encountered: