add changes

This commit is contained in:
Prakash 2026-05-18 19:43:41 +05:30
parent 12de077e6d
commit 27ef3af95b
3 changed files with 16 additions and 3 deletions

View file

@ -66,4 +66,9 @@ const server = app.listen(3020, () => {
console.log('listening on port 3020')
})
companion.socket(server)
// `setupSockets` (aliased as `companion.socket`) requires the same options
// object passed to `companion.app(...)` since PR #6248 — it now derives the
// external base path from `options.server` so WS URLs work behind reverse
// proxies. Passing only `server` throws `Cannot read properties of undefined
// (reading 'server')` inside getURLBuilder.
companion.socket(server, options)

View file

@ -71,7 +71,12 @@ app.use((err, req, res) => {
res.status(500).json({ message: err.message, error: err })
})
companion.socket(app.listen(3020))
// `companion.socket` requires the same options object passed to
// `companion.app(...)` since PR #6248 — it derives the external base path
// from `options.server` so WS URLs work behind reverse proxies. Omitting the
// second arg throws "Cannot read properties of undefined (reading 'server')"
// inside getURLBuilder.
companion.socket(app.listen(3020), companionOptions)
console.log('Welcome to Companion!')
console.log(`Listening on http://0.0.0.0:${3020}`)

View file

@ -68,7 +68,10 @@ on, you call the `socket` method like so.
// ...
const server = app.listen(PORT)
companion.socket(server)
// Pass the same `options` object you passed to `companion.app(options)`
// `companion.socket` needs `options.server` to compute the external base path
// for incoming WS URLs (important behind reverse proxies).
companion.socket(server, options)
```
### Run as standalone server