fix: 示例代码适配当前版本

This commit is contained in:
kercylan98 2023-11-11 18:30:16 +08:00
parent 24ba13cab2
commit ab72920084
2 changed files with 7 additions and 5 deletions

View File

@ -1,12 +1,14 @@
package main
import "github.com/kercylan98/minotaur/server"
import (
"fmt"
"github.com/kercylan98/minotaur/server"
)
func main() {
srv := server.New(server.NetworkWebsocket,
server.WithShunt(func(conn *server.Conn) (guid int64, allowToCreate bool) {
guid, allowToCreate = conn.GetData("roomId").(int64)
return
server.WithShunt(func(conn *server.Conn) string {
return fmt.Sprint(conn.GetData("roomId"))
}),
)
srv.RegConnectionReceivePacketEvent(func(srv *server.Server, conn *server.Conn, packet []byte) {

View File

@ -3,7 +3,7 @@ package main
import "github.com/kercylan98/minotaur/server"
func main() {
srv := server.New(server.NetworkWebsocket, server.WithTicker(50, false))
srv := server.New(server.NetworkWebsocket, server.WithTicker(50, 10, false))
if err := srv.Run(":9999"); err != nil {
panic(err)
}