Giter VIP home page Giter VIP logo

Comments (4)

simb avatar simb commented on July 29, 2024

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.

ldsang avatar ldsang commented on July 29, 2024

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.

simb avatar simb commented on July 29, 2024

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.

ldsang avatar ldsang commented on July 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.