Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

beginning of presence and here_now suport

  • Loading branch information...
commit 113557144f41fdec00943a692c88769c85700af9 1 parent ee8ff83
Tristan Sloughter authored
View
1  .gitignore
@@ -1 +1,2 @@
_build/
+ebin/
View
4 deps
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-agner install mochiweb
-agner install ibrowse
View
19 ebin/epubnub.app
@@ -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
4 rebar.config
@@ -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
2  sinan.config
@@ -3,4 +3,4 @@
{build_dir, "_build"}.
-{dep_dirs, []}.
+{dep_dirs, ["./deps/"]}.
View
15 src/epubnub.app.src
@@ -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
28 src/epubnub.erl
@@ -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,
@@ -142,6 +146,30 @@ 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
%%%===================================================================
Please sign in to comment.
Something went wrong with that request. Please try again.