EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
test-simple-connect.js
Go to the documentation of this file.
1#!/usr/bin/env node
2/**
3 * Simple Connection Test - Just connect and see what happens
4 */
5
6const WebSocket = require('ws');
7
8const url = 'wss://rmm-psa-meshcentral-aq48h.ondigitalocean.app/api/canvas-desktop/node//test-123?token=test-token';
9
10console.log('Connecting to:', url);
11
12const ws = new WebSocket(url, {
13 rejectUnauthorized: false
14});
15
16let received = false;
17
18ws.on('open', () => {
19 console.log('✅ OPEN event fired');
20});
21
22ws.on('message', (data) => {
23 received = true;
24 console.log('✅ MESSAGE received:', data.toString().substring(0, 200));
25});
26
27ws.on('close', (code, reason) => {
28 console.log('CLOSE:', code, reason || '(no reason)');
29 if (!received) {
30 console.log('❌ No messages received before close');
31 }
32 process.exit(code === 1000 ? 0 : 1);
33});
34
35ws.on('error', (err) => {
36 console.error('ERROR:', err.message);
37});
38
39// Close after 3 seconds
40setTimeout(() => {
41 console.log('Timeout - closing');
42 ws.close();
43}, 3000);