1.0.16 • Published 6 years ago

saphir-webchaussette-client v1.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
6 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

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago