Class: Session
lib/session.Session
Session class implements IQOutput interface for use with core Runtime
Implements
IQOutput
Table of contents
Constructors
Properties
Methods
- clearInputQueue
- close
- getEncoding
- getHeight
- getLineCount
- getMCIProcessor
- getNextSnack
- getPendingActions
- getWidth
- hasInput
- hasPendingActions
- incrementLineCount
- isPauseAborted
- isPauseEnabled
- processMCI
- pushSnack
- readKey
- readKeyNonBlocking
- readLine
- resetLineCount
- setCursorStyle
- setEmulatedBaudRate
- setEncoding
- setMCIContext
- setPauseAborted
- setPauseEnabled
- setSyncTermFont
- setTickCallback
- setUsername
- supportsFonts
- supportsIceColors
- waitKey
- write
- writeMCI
Constructors
constructor
• new Session(socket, mciOptions?)
Parameters
| Name | Type |
|---|---|
socket |
Socket |
mciOptions? |
MCIProcessorOptions |
Defined in
iniquity/src/lib/session.ts:83
Properties
connectedAt
• connectedAt: Date
Connection timestamp
Defined in
iniquity/src/lib/session.ts:66
info
• info: SessionInfo
Defined in
iniquity/src/lib/session.ts:68
nodeNumber
• nodeNumber: number = 0
Node number assigned by the server
Defined in
iniquity/src/lib/session.ts:60
username
• username: undefined | string = undefined
Username when logged in (set by BBS layer for snack target by user)
Defined in
iniquity/src/lib/session.ts:63
MOUSE_PREFIX
▪ Static Readonly MOUSE_PREFIX: "\u0000MOUSE:"
Sentinel for mouse events in the queue (followed by “x:y”)
Defined in
iniquity/src/lib/session.ts:57
Methods
clearInputQueue
▸ clearInputQueue(): void
Clear the pending input queue
Returns
void
Implementation of
IQOutput.clearInputQueue
Defined in
iniquity/src/lib/session.ts:564
close
▸ close(): void
Close the session
Returns
void
Implementation of
IQOutput.close
Defined in
iniquity/src/lib/session.ts:584
getEncoding
▸ getEncoding(): "cp437" | "utf8"
Get terminal encoding preference (set at connect)
Returns
"cp437" | "utf8"
Implementation of
IQOutput.getEncoding
Defined in
iniquity/src/lib/session.ts:316
getHeight
▸ getHeight(): number
Get terminal height
Returns
number
Implementation of
IQOutput.getHeight
Defined in
iniquity/src/lib/session.ts:492
getLineCount
▸ getLineCount(): number
Get current line count (for auto-pause)
Returns
number
Implementation of
IQOutput.getLineCount
Defined in
iniquity/src/lib/session.ts:436
getMCIProcessor
▸ getMCIProcessor(): MCIProcessor
Get the MCI processor instance
Returns
MCIProcessor
Implementation of
IQOutput.getMCIProcessor
Defined in
iniquity/src/lib/session.ts:361
getNextSnack
▸ getNextSnack(): null | { corner: string ; durationMs: number ; message: string }
Returns
null | { corner: string ; durationMs: number ; message: string }
Implementation of
IQOutput.getNextSnack
Defined in
iniquity/src/lib/session.ts:573
getPendingActions
▸ getPendingActions(): ControlCodeAction[]
Get pending actions from MCI processing
Returns
ControlCodeAction[]
Implementation of
IQOutput.getPendingActions
Defined in
iniquity/src/lib/session.ts:345
getWidth
▸ getWidth(): number
Get terminal width
Returns
number
Implementation of
IQOutput.getWidth
Defined in
iniquity/src/lib/session.ts:485
hasInput
▸ hasInput(): boolean
Check if input is available without blocking
Returns
boolean
Implementation of
IQOutput.hasInput
Defined in
iniquity/src/lib/session.ts:557
hasPendingActions
▸ hasPendingActions(): boolean
Check if there are pending actions
Returns
boolean
Defined in
iniquity/src/lib/session.ts:354
incrementLineCount
▸ incrementLineCount(count?): void
Increment line count
Parameters
| Name | Type | Default value |
|---|---|---|
count |
number |
1 |
Returns
void
Implementation of
IQOutput.incrementLineCount
Defined in
iniquity/src/lib/session.ts:450
isPauseAborted
▸ isPauseAborted(): boolean
Check if pause was aborted
Returns
boolean
Implementation of
IQOutput.isPauseAborted
Defined in
iniquity/src/lib/session.ts:457
isPauseEnabled
▸ isPauseEnabled(): boolean
Check if pause is enabled
Returns
boolean
Implementation of
IQOutput.isPauseEnabled
Defined in
iniquity/src/lib/session.ts:471
processMCI
▸ processMCI(text): string
Process MCI codes in text without writing
Parameters
| Name | Type |
|---|---|
text |
string |
Returns
string
Implementation of
IQOutput.processMCI
Defined in
iniquity/src/lib/session.ts:375
pushSnack
▸ pushSnack(payload): void
Parameters
| Name | Type |
|---|---|
payload |
Object |
payload.corner |
string |
payload.durationMs |
number |
payload.message |
string |
Returns
void
Implementation of
IQOutput.pushSnack
Defined in
iniquity/src/lib/session.ts:569
readKey
▸ readKey(): Promise<string>
Read a single key press (returns the character)
Returns
Promise<string>
Implementation of
IQOutput.readKey
Defined in
iniquity/src/lib/session.ts:426
readKeyNonBlocking
▸ readKeyNonBlocking(): null | string
Non-blocking key read - returns immediately
Returns
null | string
The key pressed, or null if no input available
Implementation of
IQOutput.readKeyNonBlocking
Defined in
iniquity/src/lib/session.ts:547
readLine
▸ readLine(): Promise<string>
Read a line of input from the user
Returns
Promise<string>
Implementation of
IQOutput.readLine
Defined in
iniquity/src/lib/session.ts:382
resetLineCount
▸ resetLineCount(): void
Reset line count (after pause)
Returns
void
Implementation of
IQOutput.resetLineCount
Defined in
iniquity/src/lib/session.ts:443
setCursorStyle
▸ setCursorStyle(style): void
Set cursor style (if supported)
Parameters
| Name | Type |
|---|---|
style |
string |
Returns
void
Defined in
iniquity/src/lib/session.ts:522
setEmulatedBaudRate
▸ setEmulatedBaudRate(rate): void
Set emulated baud rate (if supported)
Parameters
| Name | Type |
|---|---|
rate |
string | number |
Returns
void
Defined in
iniquity/src/lib/session.ts:513
setEncoding
▸ setEncoding(encoding): void
Set terminal encoding; updates MCI context for @CHARSET@ etc.
Parameters
| Name | Type |
|---|---|
encoding |
"cp437" | "utf8" |
Returns
void
Implementation of
IQOutput.setEncoding
Defined in
iniquity/src/lib/session.ts:323
setMCIContext
▸ setMCIContext(ctx): void
Set MCI context
Parameters
| Name | Type |
|---|---|
ctx |
Partial<MCIContext> |
Returns
void
Implementation of
IQOutput.setMCIContext
Defined in
iniquity/src/lib/session.ts:368
setPauseAborted
▸ setPauseAborted(aborted): void
Set pause aborted state
Parameters
| Name | Type |
|---|---|
aborted |
boolean |
Returns
void
Implementation of
IQOutput.setPauseAborted
Defined in
iniquity/src/lib/session.ts:464
setPauseEnabled
▸ setPauseEnabled(enabled): void
Enable/disable pause
Parameters
| Name | Type |
|---|---|
enabled |
boolean |
Returns
void
Implementation of
IQOutput.setPauseEnabled
Defined in
iniquity/src/lib/session.ts:478
setSyncTermFont
▸ setSyncTermFont(fontNameOrAlias, page?): boolean
Set SyncTERM font (if supported)
Parameters
| Name | Type | Default value |
|---|---|---|
fontNameOrAlias |
string |
undefined |
page |
number |
0 |
Returns
boolean
Implementation of
IQOutput.setSyncTermFont
Defined in
iniquity/src/lib/session.ts:499
setTickCallback
▸ setTickCallback(cb): void
Set the callback run every 10ms while waitKey() is active (e.g. processQueue + processSnacks). Used so snacks and events are processed when waiting in popup/pause/choice etc.
Parameters
| Name | Type |
|---|---|
cb |
() => Promise<void> |
Returns
void
Defined in
iniquity/src/lib/session.ts:419
setUsername
▸ setUsername(handle): void
Parameters
| Name | Type |
|---|---|
handle |
undefined | string |
Returns
void
Implementation of
IQOutput.setUsername
Defined in
iniquity/src/lib/session.ts:577
supportsFonts
▸ supportsFonts(): boolean
Check if client supports font switching
Returns
boolean
Implementation of
IQOutput.supportsFonts
Defined in
iniquity/src/lib/session.ts:539
supportsIceColors
▸ supportsIceColors(): boolean
Check if client supports iCE colors
Returns
boolean
Defined in
iniquity/src/lib/session.ts:532
waitKey
▸ waitKey(): Promise<string>
Wait for any key press (does not echo). While waiting, if a tick callback is set, runs it every 10ms (serialized, no overlap).
Returns
Promise<string>
Implementation of
IQOutput.waitKey
Defined in
iniquity/src/lib/session.ts:393
write
▸ write(data): void
Write data to socket (converts to UTF-8 when session encoding is utf8)
Parameters
| Name | Type |
|---|---|
data |
string |
Returns
void
Implementation of
IQOutput.write
Defined in
iniquity/src/lib/session.ts:305
writeMCI
▸ writeMCI(data): void
Write with MCI processing enabled (respects session encoding)
Parameters
| Name | Type |
|---|---|
data |
string |
Returns
void
Implementation of
IQOutput.writeMCI