1.2.1
Readonly clientClient Infos
Readonly internal: booleanWhether the Client IP Address is from an internal fetch
9.3.0
Readonly ip: IPAddress<4 | 6>The IP Address that the Client is using
When a valid Proxy Request is made (and proxy is enabled) this will be the proper IP
3.0.0
Readonly origin: stringThe Origin of the Clients Request
9.5.0
localhost:8000
Readonly port: numberThe Port that the Client is using
3.0.0
Readonly proxied: booleanWhether the Client IP Address is proxied
9.3.0
Readonly referrer: stringThe Referrer of the Clients Request
9.5.0
https://localhost:8000/me
Readonly userThe User Agent of the Client
3.0.0
The Request Context Object used by the server
9.0.0
The Global Context Object used by the server
9.0.0
Readonly headersA Collection of all Headers
if (ctr.headers.has('authorization')) console.log('Authorization Header is present')
console.log(ctr.headers.get('authorization')) // Will print undefined if not present
console.log(ctr.headers.get('authorization', 'hello')) // Will print 'hello' if not present
2.0.0
Readonly paramsA Collection of all Path Parameters
console.log(ctr.params.get('server')) // Will print undefined if not present
2.0.0
The Server Object that initialized this Request
9.8.0
Readonly typeThe Type of this Websocket Event
5.7.0
Readonly urlThe Requested URL
0.0.2
A Collection of all Client Cookies
import { Cookie } from "rjweb-server"
if (ctr.cookies.has('theme')) console.log('Theme Cookie is present')
console.log(ctr.cookies.get('theme')) // Will print undefined if not present
console.log(ctr.cookies.get('theme', 'light')) // Will print 'light' if not present
ctr.cookies.set('session', new Cookie(Math.random(), {
path: '/'
}))
2.0.0
A Collection of all URL Fragments
if (ctr.fragments.has('user')) console.log('User Fragment is present')
console.log(ctr.fragments.get('user')) // Will print undefined if not present
console.log(ctr.fragments.get('user', 'default')) // Will print 'default' if not present
7.0.0
A Collection of all URL Queries
if (ctr.queries.has('user')) console.log('User Query is present')
console.log(ctr.queries.get('user')) // Will print undefined if not present
console.log(ctr.queries.get('user', 'default')) // Will print 'default' if not present
2.0.0
Grab a Channel from either a string identifier or a Channel object
const channel = ctr.$channel('channel')
await channel.send('text', 'Ok')
// or
const ref = new Channel<string>()
const channel = ctr.$channel(ref)
await channel.send('text', 'Ok')
9.8.0
Context Variables that are available anywhere in the requests lifespan