Guest User

Untitled

a guest
Feb 1st, 2018
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.45 KB | None | 0 0
  1. use Cro::HTTP::Router;
  2. use Cro::HTTP::Router::WebSocket;
  3. use Daemon;
  4.  
  5. sub routes(Daemon $daemon) is export {
  6.     route {
  7.         get -> 'ws-connect' {
  8.             web-socket -> $incoming, $close {
  9.                 supply {
  10.                     whenever $incoming -> $message {
  11.                         my $body = await $message.body-text();
  12.                         emit($body);
  13.                     }
  14.                 }
  15.             }
  16.         }
  17.     }
  18. }
Add Comment
Please, Sign In to add comment