Code Monkey home page Code Monkey logo

Comments (3)

OpherV avatar OpherV commented on May 19, 2024 3

@Ulydev Actually we already have this using socket.io's interface.
for example in Spaaace:

On the client this.socket.emit('requestRestart');
https://github.com/OpherV/spaaace/blob/master/src/client/SpaaaceClientEngine.js#L40

On the server socket.on('requestRestart', makePlayerShip);
https://github.com/OpherV/spaaace/blob/d7dba3fa531e713688f7e48c36533c07677d7254/src/server/SpaaaceServerEngine.js#L49

I do feel like we need to wrap this in an Incheon API call, so that it works the same once we implement other transport methods like UDP

from lance.

Ulydev avatar Ulydev commented on May 19, 2024

I don't know if that's been done already, but it would be great to expose a simple event-based communication interface between the client and the server, something like network:on(event, callback) and network:send(event, data). This way, anyone could implement their own custom network systems such as the chat system you're talking about. It'd be as simple as sending a message to the server and then broadcast the message to all clients server-side.

from lance.

namel avatar namel commented on May 19, 2024

@Ulydev I like that idea. A low-level messaging API. I can imagine it being useful in many other cases besides chat. I'm thinking this should be a separate feature request though, because I still see value in a sample game demonstrating integration with third-party chat services.

from lance.

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.