10{
11
12 public override void ProcessGet()
13 {
14
15
16 var html = @"<html>
17 <head>
18 <script>
19 var ws = [];
20 for(let i = 0; i < 20; i++){
21 let wsx = new WebSocket('ws://localhost:8080/ws_bulk');
22 wsx.onopen = function(){
23 console.log('opened');
24 }
25 wsx.onmessage = function(e){
26 console.log(e.data);
27 }
28 wsx.onclose = function(){
29 console.log('closed');
30 }
31
32 setTimeout(function(){
33 setInterval(function(){
34 if(wsx.readyState == 1){
35 console.log('sending message from : ' + i)
36 wsx.send('hello from ' + i );
37 }
38 }, 100 * i);
39
40 }, 100 * i);
41
42 ws.push(wsx);
43 }
44
45
46 </script>
47 </head>
48 <body>
49 <h1>Websocket Test</h1>
50 </body>
51 </html>";
53 }
54}
void SendHTMLContent(string content, bool process=false, int statusCode=HTTP_CODES.OK, string encoding="UTF-8", Dictionary< string, string >? customHeaders=null)
Sends an html page passed as string.