-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: hyoguoo <[email protected]>
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/main/java/ei/algobaroapi/domain/chat/controller/SignallingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package ei.algobaroapi.domain.chat.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.messaging.handler.annotation.DestinationVariable; | ||
import org.springframework.messaging.handler.annotation.MessageMapping; | ||
import org.springframework.messaging.handler.annotation.Payload; | ||
import org.springframework.messaging.handler.annotation.SendTo; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class SignallingController { | ||
|
||
@MessageMapping("/peer/offer/{camKey}/{roomShortUuid}") | ||
@SendTo("/topic/peer/offer/{camKey}/{roomShortUuid}") | ||
public String peerHandleOffer( | ||
@Payload String offer, | ||
@DestinationVariable(value = "roomShortUuid") String roomShortUuid, | ||
@DestinationVariable(value = "camKey") String camKey | ||
) { | ||
log.info("[OFFER] {} : {}", camKey, offer); | ||
return offer; | ||
} | ||
|
||
//iceCandidate 정보를 주고 받기 위한 webSocket | ||
//camKey : 각 요청하는 캠의 key , roomShortUuid : 룸 아이디 | ||
@MessageMapping("/peer/iceCandidate/{camKey}/{roomShortUuid}") | ||
@SendTo("/topic/peer/iceCandidate/{camKey}/{roomShortUuid}") | ||
public String peerHandleIceCandidate( | ||
@Payload String candidate, | ||
@DestinationVariable(value = "roomShortUuid") String roomShortUuid, | ||
@DestinationVariable(value = "camKey") String camKey | ||
) { | ||
log.info("[ICECANDIDATE] {} : {}", camKey, candidate); | ||
return candidate; | ||
} | ||
|
||
// | ||
@MessageMapping("/peer/answer/{camKey}/{roomShortUuid}") | ||
@SendTo("/topic/peer/answer/{camKey}/{roomShortUuid}") | ||
public String peerHandleAnswer( | ||
@Payload String answer, | ||
@DestinationVariable(value = "roomShortUuid") String roomShortUuid, | ||
@DestinationVariable(value = "camKey") String camKey | ||
) { | ||
log.info("[ANSWER] {} : {}", camKey, answer); | ||
return answer; | ||
} | ||
|
||
//camKey 를 받기위해 신호를 보내는 webSocket | ||
@MessageMapping("/call/key") | ||
@SendTo("/topic/call/key") | ||
public String callKey(@Payload String message) { | ||
log.info("[Key] : {}", message); | ||
return message; | ||
} | ||
|
||
//자신의 camKey 를 모든 연결된 세션에 보내는 webSocket | ||
@MessageMapping("/send/key") | ||
@SendTo("/topic/send/key") | ||
public String sendKey(@Payload String message) { | ||
return message; | ||
} | ||
} |