Comments (4)
Hey There,
The problem you are having is that this library is dependent on the websocket library that socket.io uses. The source code for that library is submoduled in the support folder.
However if you would like to just use the alpha swc, I just uploaded it to the downloads section for this project. I'll update the readme to reflect the build requirements.
Usage has changed from what is in the current FlashSocket.IO-Demo repository. Normal messages sent from the server still come in using the FlashSocketEvent.MESSAGE event. But custom events that have been added in 0.7 of Socket.IO have their own events. Usage looks like this in your Actionscript
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
socket = new FlashSocket("dev.wordwars.net");
socket.addEventListener(FlashSocketEvent.CONNECT, onConnect);
socket.addEventListener(FlashSocketEvent.MESSAGE, onMessage);
socket.addEventListener(FlashSocketEvent.IO_ERROR, onError);
socket.addEventListener(FlashSocketEvent.SECURITY_ERROR, onError);
socket.addEventListener("game", onGame);
}
With this socket.io server
io.sockets.on('connection', function (socket) {
console.log('socket connected');
socket.send('a quick msg');
socket.emit('game', { game: currentGame });
});
A message would be sent 'a quick msg' and flash would call the onMessage handler above. Then emit sends a custom event called game. We add a game event handler in the AS3 example above.
I know this is crude but I wont get a chance to update the demo tonight and if you are trying to be productive with this I want you to have the info you need.
from flashsocket.io.
Thanks for the quick response. So for the websocket library, I notice in the socket.io installation there is a websocket.js file in the path "socket.io/lib/transports" and a websocket.js file in the path "socket.io/lib-cov/transports". In addition there seems to be an entire project here on github and I'm not sure which one I'm actually supposed to reference. Should I move one of those to the empty directory or install something? I actually have been trying to get this working, but am unclear on this aspect.
Also, I assume the download you are referring to is in the zip package you can download here, right? Or is the swc you updated available for download by itself? At any rate, I redownloaded the new zip file with the updated files and recompiled and am getting the same error. I assumed your comment meant I needed either the new alpha swc OR the websocket library, but I suspect I was mistaken as that didn't seem to compile. I did add the changes you outlined above to the mxml file and the socket.io server file. Thanks for your help.
from flashsocket.io.
Hi,
I posted a copy of the swc, so you would not have to compile at all. https://github.com/downloads/simb/FlashSocket.IO/FlashSocket.IO_0.7.0-Alpha.swc
HTH,
sim
from flashsocket.io.
Please excuse me as this is my first time actually using mxml (I generally just use .as files directly with FlashDevelop) but how do you use an swc file without compiling a new swf? I tried google, but on the adobe page it defines swc as files that are compiled into an swf. Is there some other method I should use to include that without compiling?
And I did include it as a library file and recompile, and it created an swf but I got runtime actionscript errors upon running the swf.
from flashsocket.io.
Related Issues (20)
- Support for multibyte encodings HOT 2
- Problem with transfer the project to a hosting HOT 4
- Large messages (>40kb) from client to server don't succeed. HOT 3
- Support bidirectional ACK
- support for 0.9 HOT 4
- corossdomain not loaded =( HOT 2
- Client doesn't reconnect HOT 2
- Support for Node v0.10.x HOT 8
- Discovery error with restfiy and socket.io
- GOT ALERT! type=0
- Need a example with server.js and with flashdevelop project file
- Node v0.10.x / Socket.io 0.9 do not work HOT 1
- Does this work with latest socketIO 1.3.4 and if not what changes are needed? HOT 5
- License?
- cant seem to connect HOT 4
- Can't connect. Connected Event never fires. HOT 6
- I could not connect with the help of examples. HOT 1
- Cannot connect using example. "Variable URLUtil not defined" HOT 3
- feature requests: callbacks on event 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 flashsocket.io.