(define (main . args)
(let* ((hive (make-hive))
- (sleeper (bootstrap-actor hive <sleeper>))
+ ;; (sleeper (bootstrap-actor hive <sleeper>))
(server (bootstrap-actor
hive <websocket-server>
#:port %server-port
#:on-ws-message (lambda (ws msg)
(format (current-error-port) "on-message: ~s: ~s\n" ws msg))
#:on-ws-open (lambda (ws)
- (format (current-error-port) "on-open: ~s\n" ws)))))
+ (format (current-error-port) "on-open: ~s\n" ws)
+ (format (current-error-port) "sending: AAA...\n")
+ (<- (actor-id ws) 'send (make-string (* 1024 1024) #\A))
+ (format (current-error-port) "sending: BBB...\n")
+ (<- (actor-id ws) 'send (make-string (* 1024 1024) #\B))))))
(format (current-error-port) "listening: ~s\n" %server-port)
(run-hive hive '())))
<p id="log"></p>
<script>
var server = "ws://localhost:1236";
- var log = document.getElementById ("log");
- console.log ('log=%j', log);
- console.log ('document=%j', document);
- console.log ('body=%j', document.body);
+ //var log = document.getElementById ("log");
+ //console.log ('log=%j', log);
+ //console.log ('document=%j', document);
+ //console.log ('body=%j', document.body);
var ws = new WebSocket (server);
ws.onopen = function () {
- console.log ('open!'); log.innerHTML += 'open!<br>';
+ console.log ('open!'); //log.innerHTML += 'open!<br>';
ws.send ('Hello, Web Socket!');
- ws.send ('Say: ' + 'A'.repeat (Math.pow (2, 16)) + '\n');
+ //ws.send ('Say: ' + 'A'.repeat (Math.pow (2, 16)) + '\n');
};
- ws.close = function () { console.log ('close!'); log.innerHTML += 'close!<br>'; };
- ws.onmessage = function () { console.log ('message'); log.innerHTML += 'message!<br>'; };
+ ws.close = function () { console.log ('close!'); }//log.innerHTML += 'close!<br>'; };
+ ws.onmessage = function (event) { console.log ('message:%s', event.data); }//log.innerHTML += 'message!<br>'; };
</script>
</body>
</html>