1.0.0 • Published 1 year ago

@auxilium/socket-client v1.0.0

Weekly downloads
17
License
ISC
Repository
gitlab
Last release
1 year ago

Socket Client

Client library for communicating with Datalynk's Socket Server.

Setup

Prerequisites

Instructions

  1. Install library: npm install --save @auxilium/socket-client

Prerequisites

Instructions

  1. Install dependencies: npm install
  2. Build or watch library: npm run [build|watch]
  3. Create an npm link: npm link
  4. Install library to client for testing: npm link @auxilium/client-socket

Quick Start

Minimal

import { AuxiliumSocketClient } from '@auxilium/socket-client';

const socket = new AuxiliumSocketClient('Optional URL Override, defaults to production');

Angular Wrapper

import { Injectable } from '@angular/core';
import { AuxiliumSocketClient} from '@auxilium/socket-client';

@Injectable({
	providedIn: 'root'
})
export class SocketService extends AuxiliumSocketClient {
    constructor() {
		super('Optional URL Override, defaults to production');
    }
}

const socket = new SocketService();

Examples

// call this if your token changes
socket.resume("1uf0dfbhr1g2efdoihqdubovsq", "sandbox");

// listen to records changing...
socket.onRecordChanges(52116, "sandbox")
	.subscribe(
		(changes: SliceRecordChanges) => {
			console.log('heard changes', changes);
		})

// listens to comment changes on a slice
socket.onCommentChanges(slice: number, spoke = this.defaultSpokeName);

// listens to changes on the slice itself (note, still janky)
socket.onSliceChanges(slice: number, spoke = this.defaultSpokeName);

Notes

  • socketId is a readonly property that is set when a connection to the server is established. if you attach this to your api call request object req.socket = socket.socketId, it will be the originator in the response calls
  • where arguments accept spokes, if not provided, they will default to the one set in the defaultSpoke... so... if you're only doing shit on one spoke, set it..
1.0.0

1 year ago

0.0.16

3 years ago

0.0.15

5 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago