func (s *Server) authWebsocket(ctx context.Context, ws *websocket.Conn, p *grpc.Proto, cookie string) (mid int64, key, rid string, accepts []int32, hb time.Duration, err error) {
	for {
		if err = p.ReadWebsocket(ws); err != nil {
			return
		}
		if p.Op == grpc.OpAuth {
			break
		} else {
			log.Errorf("ws request operation(%d) not auth", p.Op)
		}
	}
	if mid, key, rid, accepts, hb, err = s.Connect(ctx, p, cookie); err != nil {
		return
	}
	p.Op = grpc.OpAuthReply
	p.Body = nil
	if err = p.WriteWebsocket(ws); err != nil {
		return
	}
	err = ws.Flush()
	return
}
// auth for goim handshake with client, use rsa & aes.
auth for goim handshake with client, use rsa & aes.
// auth for goim handshake with client use rsa & aes .
func (s *Server) authWebsocket(ctx context.Context, ws *websocket.Conn, p *grpc.Proto, cookie string) (mid int64, key, rid string, accepts []int32, hb time.Duration, err error) {
	for {
		if err = p.ReadWebsocket(ws); err != nil {
			return
		}
		if p.Op == grpc.OpAuth {
			break
		} else {
			log.Errorf("ws request operation(%d) not auth", p.Op)
		}
	}
	if mid, key, rid, accepts, hb, err = s.Connect(ctx, p, cookie); err != nil {
		return
	}
	p.Op = grpc.OpAuthReply
	p.Body = nil
	if err = p.WriteWebsocket(ws); err != nil {
		return
	}
	err = ws.Flush()
	return
}
func ( s * Server ) authWebsocket ( ctx context . Context , ws * websocket . Conn , p * grpc . Proto , cookie string ) ( mid int64 , key , rid string , accepts [ ] int32 , hb time . Duration , err error ) { for { if err = p . ReadWebsocket ( ws ) ; err != nil { return } if p . Op == grpc . OpAuth { break } else { log . Errorf ( " " , p . Op ) } } if mid , key , rid , accepts , hb , err = s . Connect ( ctx , p , cookie ) ; err != nil { return } p . Op = grpc . OpAuthReply p . Body = nil if err = p . WriteWebsocket ( ws ) ; err != nil { return } err = ws . Flush ( ) return }
auth for goim handshake with client, use rsa & aes.
auth for goim handshake with client use rsa & aes .