Cyxth

index

constructors

properties

Constructors

constructor

new Cyxth(appUrl: string) : Cyxth;

create a new cyxth instance

Parameters

appUrl

cyxth app url from cyxth console https://app.cyxth.com

string
Returns
Cyxth

Properties

appUrl

cyxth app url from cyxth console https://app.cyxth.com

string

connected

check whether user is connected to cyxth servers

boolean

Methods

calls

calls(): any;

calls - video, audio, group calling functionalities

 import Cyxth from '@cyxht/core';
 import Calls from '@cyxth/calls';

 const cyx = new Cyxth(YOUR_APP_URL);
 cyx.register([Calls])

 // ensure user is connected
 await cyx.connect('USER_TOKEN')

 // then use chat
 let call: Calls = cyx.calls("channel_id");

 await call.start({audio: true, video: true});
 call.on("connected", (data) => {
   // ...
})
 call.on("join",(data) => {
  // ...
})

// call.end()
// call.leave()
// ...
Returns

Chat

any

chat

chat(): any;

get a chat instance i.e

 import Cyxth from '@cyxht/core';
 import Chat from '@cyxth/chat';

 const cyx = new Cyxth(YOUR_APP_URL);
 cyx.register([Chat])

 // ensure user is connected
 await cyx.connect('USER_TOKEN')

 // then use chat
 let chat: Chat = cyx.chat();

 chat.on("message", (message: Message) => {
	 // ... handle message
})
Returns

Chat

any

colab

colab(wasmUrl?: string) : Promise<any>;

get a colab instance i.e

 import Cyxth from '@cyxht/core';
 import Colab from '@cyxth/colab';

 const cyx = new Cyxth(YOUR_APP_URL);
 cyx.register([Colab])

 // ensure user is connected
 await cyx.connect('USER_TOKEN')

 // then use colab
 let colab: Colab = await cyx.collab("https://cdn.cyxth.com/colab_0.0.1.wasm");

Parameters

wasmUrl ?

wasm binary url

string
Returns

Colab

Promise<any>

connect

connect(token: string | TokenData) : Promise<boolean>;

connect to cyxth realtime servers

use your unique generated token

Parameters

token

user auth token

string | TokenData
Returns
Promise<boolean>

disconnect

disconnect(): boolean;

disconeect from cyxth server

Returns

true

boolean

generatePkce

generatePkce(): Promise<{ codeChallenge: string; codeVerifier: string;  }>;

generates a pkce challenge in browser

Returns

a promise with the generated pkce - codeVerifier, codeChallenge

Promise<{ codeChallenge: string; codeVerifier: string;  }>

on

on(event: CyxthEvent, cb: Function) : void;

Parameters

event
CyxthEvent
cb
Function
Returns
void

register

register(mods: any[]) : void;

register modules| plugins to use in cyxth instance core plugins include Colab, 'Chats', 'Calls'

Parameters

mods

an array of cyxth modules|plugins

any[]
Returns
void