MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / wsOnConnected

Method wsOnConnected

sdk/cliproxy/service.go:619–650  ·  view source on GitHub ↗
(channelID string)

Source from the content-addressed store, hash-verified

617}
618
619func (s *Service) wsOnConnected(channelID string) {
620 if s == nil || channelID == "" {
621 return
622 }
623 if !strings.HasPrefix(strings.ToLower(channelID), "aistudio-") {
624 return
625 }
626 if s.coreManager != nil {
627 if existing, ok := s.coreManager.GetByID(channelID); ok && existing != nil {
628 if !existing.Disabled && existing.Status == coreauth.StatusActive {
629 return
630 }
631 }
632 }
633 now := time.Now().UTC()
634 auth := &coreauth.Auth{
635 ID: channelID, // keep channel identifier as ID
636 Provider: "aistudio", // logical provider for switch routing
637 Label: channelID, // display original channel id
638 Status: coreauth.StatusActive,
639 CreatedAt: now,
640 UpdatedAt: now,
641 Attributes: map[string]string{"runtime_only": "true"},
642 Metadata: map[string]any{"email": channelID}, // metadata drives logging and usage tracking
643 }
644 log.Infof("websocket provider connected: %s", channelID)
645 s.emitAuthUpdate(context.Background(), watcher.AuthUpdate{
646 Action: watcher.AuthUpdateActionAdd,
647 ID: auth.ID,
648 Auth: auth,
649 })
650}
651
652func (s *Service) wsOnDisconnected(channelID string, reason error) {
653 if s == nil || channelID == "" {

Callers

nothing calls this directly

Calls 2

emitAuthUpdateMethod · 0.95
GetByIDMethod · 0.80

Tested by

no test coverage detected