Socket Authentication (WS)
Why WebSockets?
Caveats
Acquiring the Authentication Token
Basic Authentication (REST)Connecting to the Server
import { io, Socket } from 'socket.io-client'
const socket = io("https://api.disadus.app/", {
auth: {
token: `Bearer ${AuthToken}`,
},
});
// Socket connected;
socket.emit("user.id","TET00"); // get user with id TET00
socket.on("userResponse",(data)=>{
const { user, id } = data;
console.log(user as PublicDisadusUser);
console.log(id as string)
)Last updated