Skip to content

Commit 95890f3

Browse files
committed
Added stress-test for the net impl
1 parent c637bb1 commit 95890f3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

stress-tests/dgrr_net.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
7+
"github.com/dgrr/websocket"
8+
)
9+
10+
func OnMessage(c *websocket.Conn, isBinary bool, data []byte) {
11+
c.Write(data)
12+
}
13+
14+
func main() {
15+
wS := websocket.Server{}
16+
wS.HandleData(OnMessage)
17+
18+
s := http.Server{
19+
Addr: ":8081",
20+
Handler: http.HandlerFunc(wS.NetUpgrade),
21+
}
22+
23+
fmt.Println(s.ListenAndServe())
24+
}

0 commit comments

Comments
 (0)