Skip to content

Commit

Permalink
provide nodejitsu example
Browse files Browse the repository at this point in the history
  • Loading branch information
lipp committed Jun 17, 2014
1 parent 1482675 commit 3fc8af0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions examples/nodejitsu_fetch.lua
@@ -0,0 +1,15 @@
#!/usr/bin/env lua
-- fetches all available jet nodes,states and methods and prints
-- the basic notification info

local cjson = require'cjson'

local peer = require'jet.peer'.new({
url = 'ws://jet.nodejitsu.com:80'
})

peer:fetch({},function(path,event,data)
print(path,event,cjson.encode(data))
end)

peer:loop()
9 changes: 7 additions & 2 deletions examples/players.lua
@@ -1,5 +1,11 @@
#!/usr/bin/env lua
local peer = require'jet.peer'.new({name='players'})
local peer = require'jet.peer'.new({
-- url = 'ws://jet.nodejitsu.com:80',
name = 'players',
on_connect = function()
print('connected to Jet Daemon')
end
})
local ev = require'ev'

local players = {
Expand Down Expand Up @@ -91,4 +97,3 @@ ev.Timer.new(function()
end,2,2):start(ev.Loop.default)

peer:loop()

0 comments on commit 3fc8af0

Please sign in to comment.