Closed 4ov closed 3 years ago
Hi @4ov 👋
One gotcha I have found with ws is that the versions of the std lib for http and ws typically have to match exactly otherwise you experience hanging connections and/or errors.
Latest Opine is currently using std@0.97.0 ( https://github.com/asos-craigmorten/opine/blob/main/deps.ts#L6 ). Please try using this version for your ws import and see if issues are resolved.
Unfortunately this is not something that can be solved in Opine itself as it arises due to clashes between minor versions of the std lib itself.
Another workaround is to use importmaps to override the std lib version which Opine uses to match your preference.
As for an example, we can look to add one to this repo. In the meantime I have a working use of ws with Opine in https://github.com/cmorten/luath/blob/main/src/middlewares/lmr/mod.ts#L161 ( a Deno tool for HMR development ) which can serve as a guide, though perhaps a slightly more embedded and complex example!
Working, Thanks for helping i really appreciate it.
Issue
Setup:
Details
I'm trying to attach websocket to opine server sample code:
i hope you help me in this problem and/or give an example for using websockets