How to use it
Requirements
- Ruby 2.1.2 or greater
- Redis
Server setup
Most linux distributions have by defualt a very low open files limit. In order to sustain more than 1024 ( default ) connections, you need to apply the following changes to your system:
Add to /etc/sysctl.conf
:
fs.file-max = 50000
Add to /etc/security/limits.conf
:
* hard nofile 50000
* soft nofile 50000
* hard nproc 50000
* soft nproc 50000
$ kalerbr-pusher --app_key 765ec374ae0a69f4ce44 --secret your-pusher-secret
If all went to plan you should see the following output to STDOUT
kalebr-pusher API server listening on port 4567
kalebr-pusher WebSocket server listening on port 8080
Modifying your application code to use the Kalebr service
...
Pusher.host = 'kalebr.example.com'
Pusher.port = 4567
You will also need to do the same to the Pusher JavaScript client in your client side JavaScript, e.g
<script type="text/javascript">
var pusher = new Pusher('#{Pusher.key}', {
wsHost: "0.0.0.0",
wsPort: "8080",
wssPort: "8080",
enabledTransports: ['ws', 'flash']
});
</script>
Of course you could proxy all requests to ws.example.com
to port 8080 of your kalerbr-pusher node and api.example.com
to port 4567 of your kalerbr-pusher node for example, that way you would only need to set the host property of the Pusher client.
Author
© 2016