https://github.com/exane/fumepush-deprecated-
deprecated
https://github.com/exane/fumepush-deprecated-
Last synced: 3 months ago
JSON representation
deprecated
- Host: GitHub
- URL: https://github.com/exane/fumepush-deprecated-
- Owner: exane
- Created: 2014-05-02T16:08:12.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-30T09:25:23.000Z (over 10 years ago)
- Last Synced: 2025-02-09T13:32:51.962Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.23 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FumePush
========
# Install## Fast use
### Client
copy both files of /bin/ to your project.
include the following for client:
```html```
and then you can use it wherever you want
```javascript
var socket = new FumePush(url, port); // paste here your url and port you want to use
socket.bind(...);
socket.subscribe(...);
...
...
```### Server
create the following file as server.js (or whatever you want):
```javascript
var FumePush = require('./path/to/FumePushServer.min.js');var socket = new FumePush(port); // Remember, same port as client!
```
After that you can run server with
```cmd
cd path/to/server
node server.js
```### Debug-Console
if you want to use the debug-console then copy the folder
debug-console into your project and change the url and port to
match your client-server config. (i.e.: same url and port as for socket.io)## dev
```javascript
cmd cd root
npm install
gulp
```# Syntax
## Server
```javascript
var FumePush = require("FumePushServer.min.js");var fumePush = new FumePush(4567); //port
fumePush.bind("msg", function(data){
console.log("event called on server! room: " + data.room + " event: " + data.event + " data: "+data.data);
});setInterval(function(){
fumePush.trigger("msg", "message from server!", "channel"); //optional channel
}, 2000);```
## Client
```javascript
var fumePush = new FumePush("//localhost", 4567); //url, portvar channel = fumePush.subscribe("channel");
var chatChannel = fumePush.subscribe("chat");chatChannel.bind("msg", function(data){
// ...
});channel.bind("test", function(data){
// ...
});fumePush.bind("msg", function(data){
// ...
});fumePush.unsubscribe("channel");
fumePush.trigger("msg", "send to all clients bound by event 'msg'");
chatChannel.trigger("msg", "send to all clients bound by event 'msg' and subscribed to 'chat'");
chatChannel.broadcast("msg", "same as .trigger but clients which fired these events wont receive it back");
```