mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 16:23:30 +00:00
added start websocket function root of the extension to make universally started when the extension is called
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use arma_rs::{arma, Extension, Group};
|
||||
mod commands;
|
||||
mod structs;
|
||||
mod tests;
|
||||
mod websocket;
|
||||
@@ -30,10 +29,10 @@ pub fn init() -> Extension {
|
||||
|
||||
log4rs::init_config(config).unwrap();
|
||||
|
||||
websocket::start();
|
||||
|
||||
Extension::build()
|
||||
.group("websocket", Group::new()
|
||||
.command("start", websocket::start)
|
||||
.command("stop", websocket::stop)
|
||||
.command("message", websocket::message)
|
||||
.command("location", websocket::location)
|
||||
)
|
||||
|
||||
@@ -112,13 +112,3 @@ pub fn location(payload: LocationPayload) -> &'static str {
|
||||
}
|
||||
"sending location to all WebSocket clients"
|
||||
}
|
||||
|
||||
pub fn stop() -> &'static str {
|
||||
if let Some(ref server) = *WEBSOCKET_SERVER.lock().unwrap() {
|
||||
server.stop();
|
||||
} else {
|
||||
info!("WebSocket server is not running.");
|
||||
}
|
||||
|
||||
"Stopping WebSocket server"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user