Closed ichbtm closed 3 years ago
you could have that connection as a variable stored somewhere and just use inside the ware
in case you need server options, you can pass them to middleware args
so please be more concise cuz I'm not sure what type of functionality you want. could you share an example please? with existing solutions
let's say we have this config : machine A : behind a firewall and unreachable from the internet machine B : on the internet and reachable by machine A
machine B needs to control machine A
i can use good old tcp connection or socket.io or websocket but i'd like to use http methods (with express middleware)
so the need is the following : machine B runs a websocket server machine A runs a http server with express middleware (machine B won't connect to this server) machine A connects to ws of machine B to create a communication link machine B sends http methods to machine A through the ws link machine A receive http methods from the ws link and route them with express
@ichbtm how should that websocket link be sent? through what
with http response?
not sure to understand your question but i imagine that the ws could be passed as an argument to the tinyws constructor. if this argument is non null then tinyws would reuse this link instead of using/creating a http server it's king of a reverse connected http server in fact (the http server create the connection with the client)
@ichbtm ok I got you
I will add an optional ws object argument as second argument in the ware
hi would it be possible to use an existing ws connection? the ws server could be the rest client... and it would adapt to my use case :)