Permalink
Browse files

beginning of presence and here_now suport

  • Loading branch information...
1 parent ee8ff83 commit 113557144f41fdec00943a692c88769c85700af9 Tristan Sloughter committed Aug 30, 2012
Showing with 49 additions and 24 deletions.
  1. +1 −0 .gitignore
  2. +0 −4 deps
  3. +0 −19 ebin/epubnub.app
  4. BIN rebar
  5. +4 −0 rebar.config
  6. BIN sinan
  7. +1 −1 sinan.config
  8. +15 −0 src/epubnub.app.src
  9. +28 −0 src/epubnub.erl
View
@@ -1 +1,2 @@
_build/
+ebin/
View
4 deps
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-agner install mochiweb
-agner install ibrowse
View
@@ -1,19 +0,0 @@
-%% -*- erlang -*-
-%% This is the application resource file (.app file) for the epubnub,
-%% application.
-{application, epubnub,
- [{description, "Erlang PubNub API"},
- {vsn, "0.0.2"},
- {modules, [epubnub_app,
- epubnub_sup,
- epubnub,
-
- epn_basic_examples,
- epn_example_client]},
- {registered,[epubnub_sup]},
- {applications, [kernel, stdlib, mochiweb, ssl, ibrowse]},
- {agner, [
- {requires, ["mochiweb", "ibrowse"]}
- ]},
- {mod, {epubnub_app,[]}},
- {start_phases, []}]}.
View
BIN rebar
Binary file not shown.
View
@@ -0,0 +1,4 @@
+{deps, [
+ {mochiweb, "2.3.2", {git, "git://github.com/mochi/mochiweb.git", {tag, "v2.3.2"}}},
+ {ibrowse, "4.0.1", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.0.1"}}}
+ ]}.
View
BIN sinan
Binary file not shown.
View
@@ -3,4 +3,4 @@
{build_dir, "_build"}.
-{dep_dirs, []}.
+{dep_dirs, ["./deps/"]}.
View
@@ -0,0 +1,15 @@
+%% -*- erlang -*-
+{application, epubnub,
+ [{description, "Erlang PubNub API"},
+ {vsn, "0.0.2"},
+ {registered, [epubnub_sup]},
+ {applications, [
+ kernel
+ ,stdlib
+ ,mochiweb
+ ,ssl
+ ,ibrowse
+ ]},
+ {mod, {epubnub_app, []}},
+ {start_phases, []}
+ ]}.
View
@@ -19,6 +19,10 @@
unsubscribe/1,
subscribe/2,
subscribe/3,
+ presence/2,
+ presence/3,
+ here_now/1,
+ here_now/2,
history/2,
history/3,
time/0,
@@ -141,6 +145,30 @@ subscribe(EPN, Channel, Function, TimeToken) ->
subscribe(EPN, Channel, Function, TimeToken)
end.
+%%%===================================================================
+%%% Presence functions
+%%%===================================================================
+
+-spec presence(string(), pid() | fun()) -> json_term().
+presence(Channel, Callback) ->
+ presence(new(), Channel, Callback).
+
+-spec presence(record(epn), string(), pid() | fun()) -> json_term().
+presence(EPN, Channel, Callback) ->
+ subscribe(EPN, [Channel, "-pnpres"], Callback).
+
+%%%===================================================================
+%%% Here Now functions
+%%%===================================================================
+
+-spec here_now(string()) -> json_term().
+here_now(Channel) ->
+ here_now(new(), Channel).
+
+-spec here_now(record(epn), string()) -> json_term().
+here_now(EPN, Channel) ->
+ request([EPN#epn.origin, "here_now", EPN#epn.subkey, Channel], EPN#epn.is_ssl).
+
%%%===================================================================
%%% History functions
%%%===================================================================

0 comments on commit 1135571

Please sign in to comment.