@whoiswhere/sdk
v1.0.4
Published
whoiswhere Javascript SDK
Downloads
1
Readme
@whoiswhere/SDK
Overview
@whoiswhere/SDK
is a real-time user and application monitoring package designed to be integrated into web applications. Easily track which users are currently connected to which applications using WebSocket technology.
Note: This SDK is part of the
@whoiswhere
suite, which will later include@whoiswhere/server
.
Installation
To install the package, simply run:
npm install @whoiswhere/sdk
Usage
To use the SDK, you need to import it into your web application and call the connectWebSocket
function:
Importing
import connectWebSocket from '@whoiswhere/sdk';
Initialize WebSocket Connection
To initialize a WebSocket connection, use the connectWebSocket
function.
import { useEffect } from 'react';
import connectWebSocket from '@whoiswhere/sdk';
const MyApp = () => {
useEffect(() => {
const user = 'userName';
const appIdentifier = 'YourAppIdentifier';
const wsHost = 'ws://your-websocket-host';
connectWebSocket(user, appIdentifier, wsHost);
}, []);
return (
<div>
{/* Your application */}
</div>
);
};
Contributions
Contributions to improve the SDK are welcome. Please make sure to read the contributing guide before making a pull request.