Code Monkey home page Code Monkey logo

defnet's Issues

No protocol negotiation for websocket (tcp server and client)

Hello, working on a multiplayer game and I noticed there is no protocol negotiation in the tcp_server. If you build for HTML5 and try to connect to a server you get:

WebSocket connection to 'ws://localhost:8190/' failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE

Do I need to set up my own negotiation to use this library? Or am I missing something?

Thanks!

Fixing/Adding example for p2p_discovery

Hi, I've noticed that DefNet had a breaking change since the version 6.0.0, and that also create some issues to the p2p_discovery example.

When running the p2p_discovery example, after the client found a host, the logo instead of doing the animation, it's flying up through the screen.

My suggestion is to add self.p2p.stop in the current example, and create a new example without the stop function after the client found a server, so that people can decide whether or not they need to use the stop function in their project (or in which scenario that they might need).

Change request: 1. multiple hosts discoverable, 2. provide individual host info on discovery

Hi Britzl,

I have used your defnet library to discover hosts in a given network. It turned out that for me, the typical usecase was a little different, so I use some changes in a fork of your code. If you feel that they are useful, I would be glad if you considered them for the defnet upstream version:

  1. If I am not mistaken, you stop the discovering process after detecting the first remote host. I would prefer to allow for more than just a single host to communicate with the player. With the callback function, the application can stop the discovery process at any time it sees fit, but this change allows for finding more than one peer if needed.

  2. When searching for peers, you send a string to identify the type of host you wish to discover. Typically, to me, that would be the name/id of the game. However, I find it useful for every peer to be able to include some unique data, as well (e.g. each player's individual callsign). So instead of a test for equality of the id/name string, it is more flexible to check if the transmitted string only starts with the right string. That way, it can contain additional data that can then be evaluated by the application in the callback method.

To me, these trivial changes have been very helpful.
Please let me know what you think.

Regards,
Lutz

p2p_discovery.lua.zip

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.