2023-08-30 09:40:40 +00:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fusenapi/constants"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 消息分发工厂
|
|
|
|
type allocationProcessorFactory interface {
|
2023-09-19 02:09:22 +00:00
|
|
|
//分配数据到缓冲队列
|
2023-08-30 10:31:20 +00:00
|
|
|
allocationMessage(w *wsConnectItem, data []byte)
|
2023-08-30 09:40:40 +00:00
|
|
|
}
|
|
|
|
|
2023-10-30 10:24:42 +00:00
|
|
|
// 要添加分发在这里
|
|
|
|
var mapAllocationProcessor = map[constants.Websocket]allocationProcessorFactory{
|
|
|
|
constants.WEBSOCKET_RENDER_IMAGE: &renderProcessor{}, //渲染工厂
|
|
|
|
}
|
2023-08-30 09:40:40 +00:00
|
|
|
|
2023-11-06 02:06:33 +00:00
|
|
|
// new消息处理器
|
2023-08-30 09:40:40 +00:00
|
|
|
func (w *wsConnectItem) newAllocationProcessor(msgType constants.Websocket) allocationProcessorFactory {
|
2023-10-30 10:26:52 +00:00
|
|
|
return mapAllocationProcessor[msgType]
|
2023-08-30 09:40:40 +00:00
|
|
|
}
|