1pub(crate) mod ack;
2pub(crate) mod callback;
3#[cfg(feature = "client")]
4pub(crate) mod client;
5pub(crate) mod error;
6pub(crate) mod event;
7pub(crate) mod packet;
8pub(crate) mod payload;
9#[cfg(feature = "server")]
10pub(crate) mod server;
11
12mod socket;
13
14pub use ack::AckId;
15#[cfg(feature = "client")]
16pub use client::{Client, ClientBuilder, Socket, TransportType};
17pub use error::{Error, Result};
18pub use event::Event;
19pub use packet::{Packet, PacketType};
20pub use payload::Payload;
21#[cfg(feature = "server")]
22pub use server::{Client as ServerSocket, Server, ServerBuilder};
23
24#[cfg(feature = "server")]
25pub(crate) type NameSpace = String;
26
27#[cfg(test)]
28pub(crate) mod test {
29 use url::Url;
30
31 const SERVER_URL: &str = "http://localhost:4200";
33
34 pub(crate) fn socket_io_server() -> Url {
35 let url = std::env::var("SOCKET_IO_SERVER").unwrap_or_else(|_| SERVER_URL.to_owned());
36 let mut url = Url::parse(&url).unwrap();
37
38 if url.path() == "/" {
39 url.set_path("/socket.io/");
40 }
41
42 url
43 }
44
45 const RUST_SERVER_URL: &str = "http://localhost:4209";
47
48 pub(crate) fn rust_socket_io_server() -> Url {
49 let url =
50 std::env::var("SOCKET_IO_RUST_SERVER").unwrap_or_else(|_| RUST_SERVER_URL.to_owned());
51 let mut url = Url::parse(&url).unwrap();
52
53 if url.path() == "/" {
54 url.set_path("/socket.io/");
55 }
56
57 url
58 }
59}