DG Messenger Socket.IO
Real-time Socket.IO connection setup and event flow for DG Messenger chat and WebRTC calls.
Connecting to Socket.IO
master-backend initializes a Socket.IO server alongside Express (socketHandler(io)). Connect from your web or React Native client using your trusted origin:
ts
import { io } from 'socket.io-client';
const socket = io('https://api.timetofuture.com', {
withCredentials: true,
transports: ['websocket', 'polling'],
});
socket.on('connect', () => {
console.log('Connected to TTF Messenger:', socket.id);
});Socket.IO enforces the backend CORS_ORIGIN allowlist with credentials: true. Ensure your frontend domain is registered before connecting in production.
Last updated on
