@swalvo/live
v0.1.5
Published
Official browser SDK for the Swalvo hosted platform — RTC and chat behind one object. A thin facade over @swalvo/rtc and @swalvo/chat.
Maintainers
Readme
@swalvo/live
Swalvo for the browser, with RTC and chat behind one object.
Part of Swalvo, open-source real-time communication infrastructure.
This is a facade, not a third implementation: swalvo.rtc is a real
RTCClient from @swalvo/rtc
and swalvo.chat is a real ChatClient from
@swalvo/chat. Every
method, event and type documented for those packages applies here
unchanged, because they are those objects.
Only want calls? Use
@swalvo/rtcdirectly — it pulls in no messaging code. This package is for apps that want both planes without wiring two clients, and it mirrors the shape@swalvo/react-nativegives mobile, so the same mental model works on both.
Install
npm install @swalvo/liveUse
RTC and chat credentials are independent, so supply whichever planes your app actually uses:
import { Swalvo } from '@swalvo/live';
new Swalvo({ token, endpoint }); // calls only
new Swalvo({ chatToken, chatApiUrl }); // messaging only
new Swalvo({ token, endpoint, chatToken, chatApiUrl }); // bothconst swalvo = new Swalvo({ token, endpoint, chatToken, chatApiUrl });
const room = await swalvo.join('room_123');
await room.enableCamera();
await swalvo.chat!.connect({ room: 'room_123' });
await swalvo.chat!.sendMessage({ text: 'Hello' });Every value comes from your backend's token-mint response — none should be hand-constructed.
Live streaming
swalvo.live is available on every instance regardless of the credentials
the instance was built with: host, co-host and viewer tokens are minted
per stream, per role, by your backend.
const stream = await swalvo.live.join(credentials);
if (stream.isHost) await stream.room.enableCamera();Exports
Swalvo, createSwalvo, LiveStream, joinLiveStream, plus re-exported
Room, RTCClient, ChatClient, ChatMessage, RTCError types for
convenience.
Documentation
- Browser SDK reference · Chat SDK
- Runnable example:
examples/rtc-chat
License
MIT
