Type Alias: JSONRPCServiceEntrypointOptions
JSONRPCServiceEntrypointOptions =
JSONRPCMappingOptions&object
The options of jsonRPCServiceEntrypoint: its transport, and how the requests map to the service actions (see JSONRPCMappingOptions).
Type Declaration
end?
optionalend?:"application"|"none"| (() =>void|Promise<void>)
What happens when the stdio input ends (the parent process is gone): 'application' exits the application with the code 0 once the requests in progress are answered, 'none' does nothing, or a function run once they are answered.
Default
'application'framing?
optionalframing?:"newline"|"content-length"
How the messages are delimited on stdio: 'newline' (one JSON message per line), or 'content-length' (each message after a Content-Length header and a blank line, as in the Language Server Protocol). The responses and the notifications are written the same way.
Default
'newline'heartbeat?
optionalheartbeat?:number
The interval between the pings of the WebSocket connections, in milliseconds; 0 sends none. A connection that has not answered a ping by the next one is terminated.
Default
30000host?
optionalhost?:string
The host or address of the HTTP or WebSocket server.
Default
all the interfacesinput?
optionalinput?:Readable
The stream the stdio transport reads.
Default
process.stdinlimit?
optionallimit?:number
The largest message, in bytes. Over HTTP a larger body is answered with 413; over WebSocket the connection is closed by ws; over stdio a larger message is skipped (the rest of its line, or the length its header declares) and answered with an Invalid Request error without id (-32600).
Default
10485760 (10 MiB)listening?
optionallistening?: (server) =>void|Promise<void>
Run once the HTTP or WebSocket server listens, with the server (to read the port picked for port 0). A failure fails the entrypoint start. Not called with stdio.
Parameters
server
Server
Returns
void | Promise<void>
middlewares?
optionalmiddlewares?:MiddlewareDefinition[]
The middlewares of this adapter's actions, run after the entrypoint's global middlewares.
name?
optionalname?:string
The adapter name, to tell apart several service adapters of one entrypoint.
output?
optionaloutput?:Writable
The stream the stdio transport writes.
Default
process.stdoutpath?
optionalpath?:string
The path receiving the requests (HTTP) or the connections (WebSocket).
Default
'/'port?
optionalport?:number
The port of the HTTP or WebSocket server; 0 picks a random free port. The entrypoint fails to start when the port is in use.
Default
3000transport?
optionaltransport?:"http"|"websocket"|"stdio"
The transport of the messages: 'http' (a POST per message), 'websocket' (a message per WebSocket text frame, with the events pushed; it needs the optional package ws), or 'stdio' (the process's standard input and output, for a child process, with the events pushed). With 'stdio', the standard output belongs to the protocol: the application's logs must be written to the standard error ({class: Logger, destinations: [process.stderr]}), or they corrupt the messages.
Default
'http'