Difference between revisions of "Noobhub"
Overtorment (talk | contribs) m |
(formatting changes) |
||
Line 1: | Line 1: | ||
− | + | Noobhub is a node.js-based multiplayer and network messaging for CoronaSDK, Moai, Gideros & LÖVE | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | == Features == | ||
* Connections are routed through socket server with minimum latency, ideal for action games. | * Connections are routed through socket server with minimum latency, ideal for action games. | ||
* Simple interface. Publish/subscribe paradigm in action. | * Simple interface. Publish/subscribe paradigm in action. | ||
− | * Server written on blazing fast | + | * Server written on blazing fast node.js. |
* Socket connections, works great through any NAT (local area network), messages delivery is reliable and fast. | * Socket connections, works great through any NAT (local area network), messages delivery is reliable and fast. | ||
− | |||
Repo includes server code (so you can use your own server) and CoronaSDK/Moai/Gideros client. More clients to come. You can test on my server, credentials are hardcoded in demo project! | Repo includes server code (so you can use your own server) and CoronaSDK/Moai/Gideros 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. | Lua code may serve as an example of how LuaSocket library works. | ||
− | == | + | == Examples == |
− | + | '''client.lua''' | |
− | + | <source lang="lua"> | |
− | + | -- connect to the server | |
+ | hub = noobhub.new({ server = "127.0.0.1"; port = 1337; }); | ||
− | + | -- 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; | ||
− | |||
− | |||
− | + | end; | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
+ | -- say something to everybody on the channel | ||
+ | hub:publish({ | ||
+ | message = { | ||
+ | action = "ping", | ||
+ | timestamp = love.timer.getTime() | ||
+ | } | ||
+ | }); | ||
+ | </source> | ||
+ | == Links == | ||
+ | * [https://love2d.org/forums/viewtopic.php?f=3&t=76953 Forum thread] | ||
+ | * [https://github.com/Overtorment/NoobHub Source code] | ||
[[Category:Libraries]] | [[Category:Libraries]] | ||
+ | {{#set:LOVE Version=Any}} | ||
+ | {{#set:Description=Multiplayer and network messaging }} | ||
+ | {{#set:Keyword=Networking}} |
Latest revision as of 02:59, 27 March 2016
Noobhub is a node.js-based multiplayer and network messaging for CoronaSDK, Moai, Gideros & LÖVE
Features
- 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 node.js.
- Socket connections, works great through any NAT (local area network), messages delivery is reliable and fast.
Repo includes server code (so you can use your own server) and CoronaSDK/Moai/Gideros 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.
Examples
client.lua
-- connect to the server
hub = noobhub.new({ server = "127.0.0.1"; port = 1337; });
-- 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;
});
-- say something to everybody on the channel
hub:publish({
message = {
action = "ping",
timestamp = love.timer.getTime()
}
});
Links