1.0.16 • Published 7 years ago

saphir-webchaussette-client v1.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

Saphir WebChaussette Client

WebSockets abstraction to be used with Saphir php framework, on client side.

Installation

Download and install npm at www.npmjs.com/get-npm if you haven't already.

npm install saphir-webchaussette-client

This package is provided in ES6 module format.

Usage

import WebChaussetteClient from 'saphir-webchaussette-client';

var chaussette = new WebChaussetteClient();
chaussette.connect('localhost:8080', function(socket)
{
    socket.subscribeTo('notification_room');

    socket.on('notification', function(data)
    {
        // Do something
    });
});

If your Saphir installation is not at the root of the domain (for example if you use a lamp), like http://localhost/my-sites/test/public, you can give the root url like this :

import WebChaussetteClient from 'saphir-webchaussette-client';

var chaussette = new WebChaussetteClient();
chaussette.connect('localhost:8080', function(socket)
{
    socket.subscribeTo('notification_room');

    socket.on('notification', function(data)
    {
        // Do something
    });
},
[
	rootUrl: 'http://localhost/my-sites/test/public' // Be careful to give the url without the "/" at the end
]);

If you have to give a CSRF Token, you can do :

import WebChaussetteClient from 'saphir-webchaussette-client';

var chaussette = new WebChaussetteClient();
chaussette.connect('localhost:8080', function(socket)
{
    socket.subscribeTo('notification_room');

    socket.on('notification', function(data)
    {
        // Do something
    });
},
[
	csrfTokenInputName: '_token',
	csrfToken: '...' // Your csrf token
]); // Be careful to give the url without the "/" at the end

License

ISC

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago