@@ -57,12 +57,14 @@ pub enum BinaryResponse {
5757pub struct LazerClient {
5858 endpoint : Url ,
5959 access_token : String ,
60- ws_sender : Option < futures_util:: stream:: SplitSink <
61- tokio_tungstenite:: WebSocketStream <
62- tokio_tungstenite:: MaybeTlsStream < tokio:: net:: TcpStream > ,
60+ ws_sender : Option <
61+ futures_util:: stream:: SplitSink <
62+ tokio_tungstenite:: WebSocketStream <
63+ tokio_tungstenite:: MaybeTlsStream < tokio:: net:: TcpStream > ,
64+ > ,
65+ Message ,
6366 > ,
64- Message ,
65- > > ,
67+ > ,
6668}
6769
6870impl LazerClient {
@@ -74,8 +76,9 @@ impl LazerClient {
7476 ///
7577 /// # Returns
7678 /// Returns a new client instance (not yet connected)
77- pub fn new ( endpoint : & str , access_token : String ) -> Result < Self > {
79+ pub fn new ( endpoint : & str , access_token : & str ) -> Result < Self > {
7880 let endpoint = Url :: parse ( endpoint) ?;
81+ let access_token = access_token. to_string ( ) ;
7982 Ok ( Self {
8083 endpoint,
8184 access_token,
@@ -89,8 +92,9 @@ impl LazerClient {
8992 /// Returns a stream of responses from the server
9093 pub async fn start ( & mut self ) -> Result < impl futures_util:: Stream < Item = Result < Response > > > {
9194 let url = self . endpoint . clone ( ) ;
92- let mut request = tokio_tungstenite:: tungstenite:: client:: IntoClientRequest :: into_client_request ( url) ?;
93-
95+ let mut request =
96+ tokio_tungstenite:: tungstenite:: client:: IntoClientRequest :: into_client_request ( url) ?;
97+
9498 request. headers_mut ( ) . insert (
9599 "Authorization" ,
96100 format ! ( "Bearer {}" , self . access_token) . parse ( ) . unwrap ( ) ,
@@ -166,7 +170,7 @@ impl LazerClient {
166170 }
167171 } ) ;
168172
169- Ok ( ( client , response_stream) )
173+ Ok ( response_stream)
170174 }
171175
172176 /// Subscribes to price feed updates
0 commit comments