Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Cro::HTTP::Router;
- use Cro::HTTP::Router::WebSocket;
- use Daemon;
- sub routes(Daemon $daemon) is export {
- route {
- get -> 'ws-connect' {
- web-socket -> $incoming, $close {
- supply {
- whenever $incoming -> $message {
- my $body = await $message.body-text();
- emit($body);
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment