Comments (7)
is there any NativeWindow events that can help you like "closing"?
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/NativeWindow.html#event:closing
from as3websocket.
is there any NativeWindow events that can help you like "closing"?
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/NativeWindow.html#event:closing
Thanks for the fast response.
Yeah, I guess I can listen to the Event.CLOSE event on the NativeWindow and call websocket.close()
. But now I'm thinking... if in HTML/Javascript I don't have to listen to any UI event to make the client websocket let the server know it's being closed, why would I have to make it in an AIR application? The websocket should automatically close when the window is closed and the WebSocketServer would immediately know that the client was closed and the "close" event would be being dispatched.
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.
from as3websocket.
First of all, how do you use the AS3 websocket if it's not in an AIR app?
the NativeWindow has a "CLOSING" event, "CLOSE" is another event. "CLOSING" is fired just before the window closed.
from as3websocket.
Whoa.... people are still using this? I'm genuinely surprised, given that Flash is pretty much dead!
from as3websocket.
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.
from as3websocket.
First of all, how do you use the AS3 websocket if it's not in an AIR app?
the NativeWindow has a "CLOSING" event, "CLOSE" is another event. "CLOSING" is fired just before the window closed.
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.
But I'm not using any of this in production of course.
Although, there are still many AS3/AIR developers out there using the AIR SDK that Harman owned from Adobe.
Others like me moved on to other technologies (ReactNative/TypeScript, Xamarin/C#, Fluttert/Dart). And a very few others moved to Haxe and OpenFL.
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.
from as3websocket.
nothing is dead on computer, it's just an illusion for the sheep following the matrix...
Java is not dead, and people said 10 years ago it's dead for the web, Flash is the same
and the next couple of months/years it will rebirth as a phoenix with WASM. (check ruffle-fs)
with wasm, I'm pretty sure javascript will also die... and the sheep will jump from the cliff, believing they understood everything from their masters matrix.
from as3websocket.
Related Issues (20)
- enableDeflateStream error HOT 1
- Unable to connect HOT 2
- Endianness of binary data
- SHA1 cannot hash correctly HOT 2
- SHA1 error in AS3 Projects HOT 1
- AIR SKD 3.4 complie error
- Server HOT 1
- Type Coercion random Error
- connect websocket error
- Connecting to latest socketIO server works, but I get disconnected immediately HOT 1
- Deflate stream HOT 3
- AIR for mobile problem HOT 3
- Can't connect when embedded
- not connecting HOT 1
- Failed to connect Spring Boot 1.4.2 (Tomcat 8.5.6) HOT 4
- Excessive TLS Record length HOT 1
- Change Policy Server
- Connect to Autobahn with Subscribe HOT 3
- Request for Guidance on Upgrading to TLS 1.2 HOT 1
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 as3websocket.