Showing results for 
Search instead for 
Did you mean: 

Socket emit but no event fired Phaser

Hello everyone,

I'm developing a mobile and a web card game using Phaser. I had a problem in the mobile version when the game start no event is fired only when I refresh the page. however, the socket is emitted , but I can't see the distribution of card in real time.

Have you any idea what's cause this problem?

Tags (2)
0 Kudos
3 Replies

Sorry, but your question is very vague. Which event? What does "the socket is emitted" mean? "I can't see the distribution of the card in real time" has no meaning to me.

Please search the web for "cordova phonegap phaser game issues" for general programming help. We are not staffed to provide general HTML5 programming help. We are here to help you with issues related to building and debugging with the XDK.


Sorry for asking in that way.

I should explain more. I have a multiplayer game which connect to a node js server via socket . every time I get the result from the server my client side doesn't fire events of the game. however, this couldn't be a problem in phaser because I use the same code in web and I have no problem but in XDK it doesn't update the view when the client receive data from server nodeJs only when refresh it by reopening the page

        socket.on('join', onJoin);
        socket.on('seat', onSeat);
        socket.on('first-card', onFirstCard);
        socket.on('change', onChange);
        socket.on('bet', onBet);
        socket.on('card', onCard);
        socket.on('stop', onStop);
        socket.on('fold', onFold);
        socket.on('new-game', onNewGame);
        socket.on('split', onSplit);
        socket.on('burn-out', onBurnOut);
        socket.on('five-cards', onFiveCards);
        socket.on('challenge', onChallenge);
        socket.on('become-bank', onBecomeBank);
        socket.on('up-to-buy-in', onUpToBuyIn);
        socket.on('leave', onLeave);

I hope it's clear now. 


Cordova apps (which is what the XDK creates) are not part of a server, there is no server. So tightly knit server-client architectures are not possible in the Cordova environment. You have to create a loosely-coupled server-client system. The client (your Cordova app) must contact the server (some network-based entity) using standard networking protocols, such as web-sockets or http RESTful APIs. There is no node.js component in a Cordova app, it is strictly an HTML5 client app that has no server.

Search the web for "cordova client server app solutions" for additional help.