| 47 | } |
| 48 | |
| 49 | bool WsPlugin::OnCreate(const tc::GrPluginParam& param) { |
| 50 | GrPluginInterface::OnCreate(param); |
| 51 | auto listen_port = GetConfigIntParam("ws-listen-port"); |
| 52 | auto config_listen_port = GetConfigIntParam("listen-port"); |
| 53 | if (config_listen_port > 0) { |
| 54 | listen_port = config_listen_port; |
| 55 | } |
| 56 | ws_server_ = std::make_shared<WsPluginServer>(this, (uint16_t)listen_port); |
| 57 | ws_server_->Start(); |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | bool WsPlugin::OnDestroy() { |
| 62 | if (ws_server_) { |