synchronous communication (embedded http server?)

0 favourites
  • 4 posts
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • Hello,

    I have been connecting a game with a peer system using websockets. However, I now noticed that websockets is purely asynchronous, and at times the peer system needs to request data from the game -- and best if its synchronous request, so that the peer obtains the requested data immediately.

    WebSockets doesn't support that -- i would need to code a synchronous "fetch" via coordinated asynchronous calls.

    However, I then thought that a construct 3 game could in fact run a web server as well, and then a web request could be submitted?

    Can this be done?

    Is there another way to do this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I now noticed Redis and a node.js redis client. Perhaps, a more robust connection to peers is via such an infrastructure.

    Can Redis be used in construct3 via node.js?

    I guess, one would need to import node.js and then install into it the redis client -- can this be done in construct 3.

    And, then i guess I would write some interface functions to use within the game code.

  • Browsers don't really support synchronous network requests. There is too high a chance that it would cause the page to hang and interrupt the user experience. (There is synchronous XHR but I am sure browser makers would get rid of it if the backwards compatibility wasn't such a problem.)

    My advice is just do it asynchronously.

  • Thank you.

    Yes, good point.

    That is what i eventually did -- a lot of ping pong'ing between the the C3 game and the peer app.

    But, i guess, the hanging problem could be avoided if the communication happens in a seperate thread -- if its possible easily to do

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)