mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-06 01:56:20 +00:00
2163302190
* Invoke hook when server starts Invokes the `th-server-command-start` hook when the server is started, with the server object as the parameter. This allows adding a WebSocket listener to the server. * Return the HTTP server from the listen function Returns the node HTTP server created in the listen function to allow extension * Add node HTTP server to server-command-start hook * Change hook to post start in case we add a pre-start hook * Create Hook__th-server-command-post-start.tid
19 lines
676 B
Plaintext
19 lines
676 B
Plaintext
created: 20180409142128584
|
|
modified: 20180409142128584
|
|
tags: HookMechanism
|
|
title: Hook: th-server-command-post-start
|
|
type: text/vnd.tiddlywiki
|
|
|
|
This hook allows plugins to extend the TiddlyWiki server command after it initializes. The two
|
|
most obvious use cases are adding routes (such as an attachments folder for external files)
|
|
to the SimpleServer instance and adding a websockets handler to the HTTP server.
|
|
|
|
Hook function parameters:
|
|
|
|
* SimpleServer instance
|
|
** Defined in core/modules/commands/server.js
|
|
* NodeJS HTTP Server instance
|
|
** See the NodeJS docs at [ext[https://nodejs.org/docs/latest-v8.x/api/http.html#http_class_http_server]]
|
|
|
|
Return value is ignored.
|