-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.js
More file actions
46 lines (39 loc) · 1.03 KB
/
client.js
File metadata and controls
46 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*!
* RMSN JavaScript Library v0.0.1
* https://github.com/leppert/RMSN
*
* Copyright 2011, Greg Leppert
* Released under the MIT licence.
*
* Shamelessly hijacking Pusher's API
* http://pusher.com
*/
var RMSN = Pusher; //Alias RMSN to Pusher
now.ready(function(){
RMSN.prototype.connect = function(){
self = this;
now.rmsn = {
connection: {
key: self.key,
emit: function(event_name, data){ self.connection.emit(event_name, data); }
}
};
};
RMSN.prototype.subscribe = function(channel_name){
var channel = this.channels.add(channel_name, this);
now.RMSN.subscribe(channel_name);
this.send_event('pusher:subscribe', {
channel: channel_name,
auth: false, //data.auth,
channel_data: false //data.channel_data
});
return channel;
};
RMSN.prototype.unsubscribe = function(channel_name){
this.channels.remove(channel_name);
now.RMSN.unsubscribe(channel_name);
this.send_event('pusher:unsubscribe', {
channel: channel_name
});
};
});