New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebSocket client #1051
Comments
@WebFreak001 you mean like for the client-side (eg javascript) or a vibe.d websocket client that connects to another server that has websockets? |
No I want the vibe.d server to connect to a websocket server. There is also TCPclient so why not WebSocket client |
@WebFreak001 well websocket was not made for server-to-server connection. It shouldnt be to hard to implement but to me honestly do not see the point. maybe @s-ludwig could talk explain? Also could you explain what youre trying to do? Maybe there is a different solution. I honest feel that the websocket should be slighly rewritten. |
I want to make a chat bot for hitbox (which uses websockets). I used nodejs before but now i switched to vibe.d because not having actual classes in javascript (Not prototype stuff, JSON or new Function) is really annoying. (I tried TypeScript but the compiler is bugged and now I really hate it and I dont like coffeescript or dart) |
This would be relatively straight forward to do, mostly reusing the existing code. I can't personally promise a date when I would have the time to actually implement and test it, though. |
@WebFreak001 is the websockets are for javascript for client-side to talk to the server and youre trying to talk to another server at the same time, you could look into using the rest interface. I use the rest interface to send data back and forth between the servers (I would use tcp for that but i decided to just use rest for now). Like @s-ludwig said, it should be straight forward. I dont think it should be to hard to do though, but I moved to vibe.d because I did get tired of node.js. I normally try to stick with system languages like go, d, rust, c/c++. |
The client basically does the inverse of the server negotiation: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/websockets.d#L69 I would suggest to follow the RFC. As for the Websocket class and all the rest, I don't think there's any difference. Probably a 100 lines of code missing there. |
If not even much less! |
The only particularities I can see is this
|
Usage would look like this: void handler(scope WebSocket ws) { .. }
requestHTTP("http://....", (scope req) { handleWebsocket(&handler, req); }); The HTTPClientRequest will need a |
would be great to have this in. |
Just found out about |
It would be nice if there would be an WebSocket client for connecting to externals servers and redirecting that output to the user and process it on the server.
The text was updated successfully, but these errors were encountered: