npm@sama-communications/sdk
A SDK client for interacting with the SAMA chat server from Web/Node.js apps.
We’ve moved all the essential server interaction methods into a separate class. With these methods, you can seamlessly integrate the SDK into your project and use it in your existing components.
This is a demo app to test all these methods https://app.samacloud.io/demo
How to Get Started
Section titled “How to Get Started”-
Install packge to your app:
Terminal window npm install @sama-communications/sdk -
Create an SDK sample and store it in a variable:
import { SAMAClient } from "@sama-communications/sdk";const config = {endpoint: {ws: "wss://your-websocket-url"http: "https://your-websocket-url.com"}}const client = new SAMAClient(config); -
All done. Try out the methods above.
client.connect().then(() => {console.log("Connected to the server");}).catch((error) => {console.error("Failed to connect to the server:", error);});client.userLogin({ login: "user_login", password: "user_password" }).then((response) => {console.log("User logged in:", response);}).catch((error) => {console.error("Failed to log in:", error);});
See Also
Section titled “See Also” sama-client/.../api.ts Here you can find all the methods that are currently available.
SAMA Mar 2025 Updates: NEW SAMA SDK Interacting with the SAMA API just got way easier! 😀