# NServer **Repository Path**: Looppeett/nserver ## Basic Information - **Project Name**: NServer - **Description**: NServer based on netty and springboot - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-03-09 - **Last Updated**: 2022-05-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: Netty, SpringBoot, zookeeper ## README # NServer add parameters when use java -jar to start cluster application `--nserver.node.ip=192.168.10.10` `--nserver.node.port=19888` `--nserver.node.contextPath=` `--nserver.zookeeperServerAddr=zoo:2181,zoo:2182,zoo:2183` `--nserver.cluster.enable=true` or add nothing to to start standalone application after startup application you can use `ws://127.0.0.1:19888/connect?token={your username}` to connect the server then you can send a message for returning all online users ```json {"routerKey":"ping"} ``` or send a message for pushing an order to special users ```json {"routerKey":"command","data":{"order":1,"receivers":[{"node":"9675ec61","username":"thomas","contextId":"b230f9c4"}],"value":"Hello World command"}} ``` or send a message for pushing an order to all users ```json {"routerKey":"broadcast","data":{"order":1,"value":"Hello World broadcast"}} ``` message's order and value will be pushed originally # Router support alias for router just add some configurations when create RouteModule ```java @Service @RequiredArgsConstructor(onConstructor_ = @Autowired) public class RouterModule extends RouterModuleAbstract { private final ValidatorFactory factory; private final List baseServiceList; @Override public void configure(RouterConfigure configure) { configure .withValidatorFactory(factory) .withBaseServices(baseServiceList) .withRouterAlias("r", "d"); } } ``` then you can choose > r for routerKey > > d for data