1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

some cleanup, and remove the test 'testwebocket2' package at all; A lower-level fast websocket impl based on gobwas/ws will be published on a different repo, it is a WIP

Former-commit-id: b680974c593196ce20865ed12778929ced6afea1
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-02-22 21:24:10 +02:00
parent c477251d1f
commit bda36145e5
25 changed files with 110 additions and 2769 deletions

View File

@@ -8,11 +8,11 @@ import (
"time"
"github.com/kataras/iris"
"github.com/kataras/iris/websocket2"
"github.com/kataras/iris/websocket"
)
const totalClients = 16000 // max depends on the OS.
const http = true
const verbose = true
func main() {
@@ -62,32 +62,9 @@ func main() {
}
}()
if http {
app := iris.New()
app.Get("/", ws.Handler())
app.Run(iris.Addr(":8080"))
return
}
// ln, err := net.Listen("tcp", ":8080")
// if err != nil {
// panic(err)
// }
// defer ln.Close()
// for {
// conn, err := ln.Accept()
// if err != nil {
// panic(err)
// }
// go func() {
// err = ws.HandleConn(conn)
// if err != nil {
// panic(err)
// }
// }()
// }
app := iris.New()
app.Get("/", ws.Handler())
app.Run(iris.Addr(":8080"))
}
@@ -103,7 +80,9 @@ var count uint64
func handleDisconnect(c websocket.Connection) {
atomic.AddUint64(&count, 1)
// log.Printf("client [%s] disconnected!\n", c.ID())
if verbose {
log.Printf("client [%s] disconnected!\n", c.ID())
}
}
func handleErr(c websocket.Connection, err error) {