/////
Search
📝

웹소켓 연결

전략

개요

연결 정보

Base URL: wss://your-domain.com/api/ws
인증: Query Parameter로 토큰 전달 (?token=Bearer_xxx)
프로토콜: WSS (TLS 필수)

1. 로그 스트리밍

Endpoint

wss://your-domain.com/api/ws/services/{service_name}/logs
Plain Text
복사

Parameters

파라미터
타입
필수
설명
service_name
string
서비스명 (path)
token
string
인증 토큰 (query)
level
string
로그 레벨 필터 (query)

로그 레벨

error: 에러 로그만 (기본값)
warning: 경고 로그만
info: 정보 로그만
all: 모든 레벨

연결 예시

wss://your-domain.com/api/ws/services/user-service/logs?token=Bearer_xxx&level=error
Plain Text
복사

메시지 포맷 (서버 → 클라이언트)

{ "type": "log", "service_name": "user-service", "timestamp": "2025-11-07T10:35:22.999Z", "data": { "log_id": "log_123abc", "level": "error", "message": "Database connection failed", "trace_id": "trace_abc123", "span_id": "span_002", "attributes": { "error.type": "ConnectionError", "database.host": "db-primary" } } }
JSON
복사

필수 필드

필드
타입
설명
type
string
항상 "log"
service_name
string
서비스명
timestamp
string
ISO 8601 형식
data.log_id
string
로그 고유 ID
data.level
string
error/warning/info
data.message
string
로그 메시지

선택 필드

필드
타입
설명
data.trace_id
string
연관 트레이스 ID
data.span_id
string
연관 스팬 ID
data.attributes
object
추가 메타데이터

2. 알림

Endpoint

wss://your-domain.com/api/ws/notifications
Plain Text
복사

Parameters

파라미터
타입
필수
설명
token
string
인증 토큰 (query)
service
string
특정 서비스만 구독 (query)

연결 예시

# 모든 알림 wss://your-domain.com/api/ws/notifications?token=Bearer_xxx # 특정 서비스만 wss://your-domain.com/api/ws/notifications?token=Bearer_xxx&service=user-service
Plain Text
복사

메시지 포맷 (서버 → 클라이언트)

{ "type": "notification", "notification_id": "notif_abc123", "timestamp": "2025-11-07T10:35:22.123Z", "data": { "notification_type": "error_spike", "severity": "critical", "title": "에러율 급증 감지", "message": "user-service의 에러율이 5%를 초과했습니다", "service_name": "user-service", "metadata": { "current_error_rate": 12.3, "threshold": 5.0 }, "action_url": "/services/user-service/errors" } }
JSON
복사

필수 필드

필드
타입
설명
type
string
항상 "notification"
notification_id
string
알림 고유 ID
timestamp
string
ISO 8601 형식
data.notification_type
string
알림 유형
data.title
string
알림 제목
data.message
string
알림 내용
data.service_name
string
서비스명

선택 필드

필드
타입
설명
data.metadata
object
추가 정보
data.action_url
string
상세 페이지 URL

알림 유형

error_spike: 에러율 급증
latency_spike: 레이턴시 급증
service_down: 서비스 다운
error_new: 새로운 에러 발생
threshold_exceeded: 임계값 초과

참고

연결 관리
에러 처리