项目介绍

Overtorment/NoobHub 是一个托管在 GitHub 上的开源项目,主要使用 Lua 编写,目前获得 357 个 Star、54 次 Fork。

仓库全名
Overtorment/NoobHub
Star 数
357
Fork 数
54
未关闭 Issue
2

README 摘要

NoobHub OpenSource multiplayer and network messaging for CoronaSDK, Moai, Gideros, LÖVE & Defold Battle-tested and production ready. Handling thousands of CCU (concurrent users), serving hundreds of thousands multiplayer games daily, routing hundreds of messages per second, with months of uptime. Connections are routed through socket server with minimum latency, ideal for action games. Simple interface…

完整内容见 GitHub 原始 README 或本页 。

常见问题

NoobHub 用什么语言开发?

主要使用 Lua 编写,目前有 357 个 Star。

如何获取 NoobHub 的源码?

可以直接克隆仓库:git clone https://github.com/Overtorment/NoobHub.git,默认分支为 master;安装与运行步骤见仓库 README。

NoobHub 最近还在维护吗?

仓库最近一次更新为 6月22日,当前有 2 个未关闭 Issue;Star 数为 357,可作为社区活跃度的参考。

关于

🌐🔥 Network multiplayer and messaging for CoronaSDK, Moai, Gideros, LÖVE & Defold

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
504
价值分
234
活跃状态
活跃

README

NoobHub

JavaScript Style Guide

OpenSource multiplayer and network messaging for CoronaSDK, Moai, Gideros, LÖVE & Defold

Battle-tested and production ready. Handling thousands of CCU (concurrent users), serving hundreds of thousands multiplayer games daily, routing hundreds of messages per second, with months of uptime.

  • Connections are routed through socket server with minimum latency, ideal for action games.
  • Simple interface. Publish/subscribe paradigm in action.
  • Server written on blazing fast Nodejs.
  • Zero dependency. Works out of the box, no NPM ecosystem required. (for websocket bridge relies on ws module, read below)
  • Socket connections, works great through any NAT (local area network), messages delivery is reliable and fast.
  • Low CPU and memory footprint

Repo includes server code (so you can use your own server) and CoronaSDK/Moai/Gideros/LÖVE client. More clients to come. You can test on my server, credentials are hardcoded in demo project!

Lua code may serve as an example of how LuaSocket library works.

How to use it

START SERVER

        $ nodejs node.js

To make use of the websocket bridge, uncomment wsPort in the config.
If so, make sure to do npm install as well.
These are useful to serve browser clients. Irrelevant otherwise.

INITIALIZE

        hub = noobhub.new({ server = "127.0.0.1"; port = 1337; });
const hub = noobhub.new({ server: '127.0.0.1', port: 2337 });

SUBSCRIBE TO A CHANNEL AND RECEIVE CALLBACKS WHEN NEW JSON MESSAGES ARRIVE

        hub:subscribe({
          channel = "hello-world";
        	callback = function(message)

        		if(message.action == "ping")   then
        			print("Pong!")
        		end;

        	end;
        });
hub.subscribe({
  channel: 'hello-world',
  callback: (data) => {
    console.log('callback', data);
  }
});

SAY SOMETHING TO EVERYBODY ON THE CHANNEL

        hub:publish({
            message = {
                action  =  "ping",
                timestamp = system.getTimer()
            }
        });
hub.publish({
  action: 'ping',
  timestamp: Date.now()
});

Clients

  • CoronaSDK
  • Gideros
  • Moai
  • LÖVE
  • Node.js
  • PHP (debug console only)
  • JS / Browser

Tests

Simple acceptance test uses Nodejs client to test the server itself:

    $ ./run-tests.sh
    starting Noobhub server...
    NoobHub on :::1337
    running tests...
    tests ok

Getting ready for production use

If you expect more than 1000 concurrent connections, you should increase limits on your server (max open file descriptors, max TCP/IP connections) and optionally fine-tune your server’s TCP/IP stack. To make sure server process stays alive you might want to use tools such as forever.js or supervisord.

Authors

  • Igor Korsakov
  • Sergii Tsegelnyk

Licence

WTFPL

Official discussion thread

评论

暂无评论