-
Notifications
You must be signed in to change notification settings - Fork 0
CommandRegistry
The command registry is how all messages are managed internally. When a command is invoked, a message is created by
the socket's command registry. It generate a new non-colliding id for the message and adds the message and the
message's completion handler to the internal map.
When you setup either a LiSocket or LiServer you provide generic parameters that conform to
LiCommandRegistryStructure. There are three types of possible command registries.
The local command registry is referred to as LC in parameters. These are the commands that the socket will implement.
The remote command registry is referred to as RC in parameters. These are the commands that the socket will invoke.
The sibling command registry is referred to as SC in parameters. These are the commands that the socket can invoke on
its siblings.
To create a registry, just make an interface that extends LiCommandRegistryStructure like below:
export interface MyServerCommands extends LiCommandRegistryStructure {
changeFavoriteNumber: {
param: number;
return: void;
};
getFavoriteColor: {
param: void;
return: number;
};
}Created by Elijah Cobb provided under the MIT license.
Element is a group of developer tools I have built in TypeScript. Check them out at: element-ts.com.
Author: Elijah Cobb
NPM: @element-ts/lithium
Issue Reporting: Github Issues