package ws

import (
	"LAPP_LF_MOM_BACKEND/global"
	"LAPP_LF_MOM_BACKEND/messaging"
	baseModel "LAPP_LF_MOM_BACKEND/models/base"
	"errors"
	"github.com/kataras/neffos"
)

func init()  {
	global.WebsocketContext = messaging.Register(baseModel.NAMESPACE_EODS, neffos.Events {})
	global.WebsocketContext.SetAuthenticator(func(headers map[string]string) (string, error) {
		stn, ok := headers["STN"]
		if !ok || stn == "" {
			return "", errors.New("未获取到工位信息")
		}
		return stn, nil
	})
}
