mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-13 02:17:35 +08:00
优化rpc
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
package sysservice
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/network"
|
||||
"github.com/duanhf2012/origin/service"
|
||||
)
|
||||
|
||||
type WSServerService struct {
|
||||
service.BaseService
|
||||
wsserver network.WebsocketServer
|
||||
|
||||
pattern string
|
||||
port uint16
|
||||
messageReciver network.IMessageReceiver
|
||||
bEnableCompression bool
|
||||
}
|
||||
|
||||
func (ws *WSServerService) OnInit() error {
|
||||
|
||||
ws.wsserver.Init(ws.pattern, ws.port, ws.messageReciver, ws.bEnableCompression)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ws *WSServerService) OnRun() error {
|
||||
ws.wsserver.Start()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewWSServerService(pattern string, port uint16, messageReciver network.IMessageReceiver, bEnableCompression bool) *WSServerService {
|
||||
wss := new(WSServerService)
|
||||
wss.pattern = pattern
|
||||
wss.port = port
|
||||
wss.messageReciver = messageReciver
|
||||
wss.bEnableCompression = bEnableCompression
|
||||
|
||||
wss.Init(wss, 0)
|
||||
return wss
|
||||
}
|
||||
|
||||
func (ws *WSServerService) OnDestory() error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user