Houzes Socket

Installation

npm install

Usage

jQuery

Create Socket Connection with Auth Token

let host = '58.84.34.65:3001';
let socket = io(host,{
    query: "token=<access_token>"
});

Socket Connection on Success

socket.on('connected', userEmail => {
            console.log(userEmail+' connected');
        });

Socket Connection on Error

socket.on('error', err=>{
            console.log('');
        });

Driver To Share Location with Nearby Users

socket.emit('location::share',{
    latitude: 23.831735,
    longitude: 90.416504
});

Sharing Location on Error

socket.on('location::error', err => {
            console.log(err);
        });

Track Nearby Drivers' Location

socket.on('location::receive', data => {
            console.log(data);
        });

See also