demo: polyfill global WebSocket for Node (fixes register-test.mjs) #3

Open
mohlec wants to merge 1 commit from fix/node-websocket-polyfill into main
Owner

register-test.mjs crashed with ReferenceError: WebSocket is not defined on plain Node -- SIP.js's transport expects a global WebSocket, which only browsers provide natively. The script never actually tested anything before this fix.

Found while running the first real test against a FreePBX extension for task #1. Added ws as a devDependency + polyfill globalThis.WebSocket. Confirmed working against both a dead public demo endpoint (now times out correctly) and the real FreePBX target (now gets a genuine TCP connection-refused, diagnosing an actual PBX-side gap instead of a meaningless client crash).

register-test.mjs crashed with ReferenceError: WebSocket is not defined on plain Node -- SIP.js's transport expects a global WebSocket, which only browsers provide natively. The script never actually tested anything before this fix. Found while running the first real test against a FreePBX extension for task #1. Added ws as a devDependency + polyfill globalThis.WebSocket. Confirmed working against both a dead public demo endpoint (now times out correctly) and the real FreePBX target (now gets a genuine TCP connection-refused, diagnosing an actual PBX-side gap instead of a meaningless client crash).
demo: polyfill global WebSocket for Node (fixes register-test.mjs)
All checks were successful
Build slash-sip-client / build (pull_request) Successful in 5s
4cd4540c4e
Node has no native global WebSocket -- that's a browser API SIP.js's
transport expects to exist unconditionally. Running register-test.mjs
on plain Node failed immediately with 'ReferenceError: WebSocket is
not defined', regardless of whether the target SIP server was even
reachable -- meaning the script never actually tested anything.

Found while running the first real test against a FreePBX extension
(task #1): added 'ws' as a devDependency and polyfill globalThis.WebSocket
before the SoftphoneLine import. Confirmed working both against a dead
public demo endpoint (now correctly times out instead of crashing) and
the real FreePBX target (now gets a real TCP-level connection refused,
diagnosing an actual PBX-side gap -- port 8089 WSS transport not yet
enabled -- instead of a meaningless client-side crash).
All checks were successful
Build slash-sip-client / build (pull_request) Successful in 5s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/node-websocket-polyfill:fix/node-websocket-polyfill
git switch fix/node-websocket-polyfill

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fix/node-websocket-polyfill
git switch fix/node-websocket-polyfill
git rebase main
git switch main
git merge --ff-only fix/node-websocket-polyfill
git switch fix/node-websocket-polyfill
git rebase main
git switch main
git merge --no-ff fix/node-websocket-polyfill
git switch main
git merge --squash fix/node-websocket-polyfill
git switch main
git merge --ff-only fix/node-websocket-polyfill
git switch main
git merge fix/node-websocket-polyfill
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-sip-client!3
No description provided.