-
Notifications
You must be signed in to change notification settings - Fork 23
/
README.hbs
142 lines (101 loc) · 3.77 KB
/
README.hbs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Symple Server
The Symple Node.js server is a real time messaging server built on top of `socket.io` and `redis` for creating blazing fast messaging applications quickly and easily. Use cases include chat, sms, media streaming, and games that run in the web browser, desktop, or on mobile devices.
## What is Symple?
Symple is an unrestrictive real time messaging and presence protocol that implements the minimum number of features required to build full fledged messaging applications with security, flexibility, performance and scalability in mind. These features include:
* Session sharing with any backend (via Redis)
* User rostering and presence
* Media streaming (via WebRTC, [see demo](http://symple.sourcey.com))
* Scoped messaging ie. direct, user and group scope
* Real-time commands and events
* Real-time forms
## Installation
[Install Redis](http://redis.io/download) Note that Redis is optional, but required if you want to share secure sessions. If you're using Ubuntu just type:
```
sudo apt-get install redis-server
```
Install Symple from npm:
```bash
npm install symple
# use the --save flag to automatically add Symple to your package.json dependencies
# npm install symple --save
```
Done.
## Usage
To get started straight away fire up the default server by typing:
```bash
node server
# or using npm
# npm start
```
The `server.js` file in the root directory of the repo provides an example of how to include the Symple server in your own code:
```bash
// include Symple
var Symple = require('symple');
// instantiate the Symple server
var sy = new Symple();
// load a config file
sy.loadConfig(__dirname + "/symple.json");
// initialize the server
sy.init();
// access socket.io instance methods if required
// sy.io.use(function(socket, next) { });
// access HTTP/S server instance methods if required
// sy.http ...
// access Redis publish/subscribe client instance methods
// sy.pub ...
// sy.sub ...
console.log('Symple server listening on port ' + sy.config.port);
```
See the [configuration options](#configuration) below for a list of available options.
Once the server is up and running you need a client to connect to it. There are a number of options here in the following languages:
* JavaScript: https://github.com/sourcey/symple-client
* Ruby: https://github.com/sourcey/symple-client-ruby
* C++: https://github.com/sourcey/libsourcey/tree/master/src/symple
## Configuration
To configure the server just modify `symple.json` as needed:
```
{
/*
The port to listen on (default: 4500).
If `process.env.PORT` is set, the env value will be used instead.
Port 443 should always be used for SSL.
*/
"port" : 4500, /* 443 */
/*
Session time-to-live in minutes (default: 15 minutes)
This is the duration of time before sessions expire after the client disconnects.
If set to `-1` the session will never expire.
*/
"sessionTTL" : 15,
/* Enable or disable authentication */
"authentication" : true,
/*
Redis configuration
Redis must be available if using `authentication = true`
*/
"redis" : {
"host" : "localhost",
"port" : 6379,
"password" : "redispwd"
},
/* SSL configuration */
"ssl" : {
"enabled" : false,
"key" : "ssl/symple.key",
"cert" : "ssl/symple.crt"
}
}
```
## API Reference
{{optionSet "example-lang" "js" ~}}
{{>main}}
## Contributing
Contributions are always welcome :)
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Contact
For more information check out the Symple homepage: http://sourcey.com/symple/
For bugs or issues please use the Github issue tracker: https://github.com/sourcey/symple-server-node/issues