1 -- Change these: |
1 -- Change these: |
2 local jid, password = "user@example.com", "secret"; |
2 local jid, password = "user@example.com", "secret"; |
|
3 local url = "http://example.com:80/http-bind"; |
3 |
4 |
4 -- This line squishes verse each time you run, |
5 -- This line squishes verse each time you run, |
5 -- handy if you're hacking on Verse itself |
6 -- handy if you're hacking on Verse itself |
6 --os.execute("squish --minify-level=none verse"); |
7 --os.execute("squish --minify-level=none verse"); |
7 |
8 |
8 require "verse" -- Verse main library |
9 require "verse" -- Verse main library |
9 require "verse.bosh" -- Verse BOSH support |
10 require "verse.bosh" -- Verse BOSH support |
10 require "verse.client" -- XMPP client library |
11 require "verse.client" -- XMPP client library |
11 |
12 |
12 c = verse.new_bosh(nil, "http://example.com:5280/http-bind"); |
13 c = verse.new_bosh(nil, url); |
13 c:add_plugin("version"); |
14 c:add_plugin("version"); |
14 |
15 |
15 -- Add some hooks for debugging |
16 -- Add some hooks for debugging |
16 c:hook("opened", function () print("Stream opened!") end); |
17 c:hook("opened", function () print("Stream opened!") end); |
17 c:hook("closed", function () print("Stream closed!") end); |
18 c:hook("closed", function () print("Stream closed!") end); |