Skip to content

Commit

Permalink
Merge pull request #170 from 1e5i-Shark/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
GiHoo authored Apr 19, 2024
2 parents fbf61bf + e99dcc0 commit 79c8990
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

![Algobaro Logo](https://github.com/1e5i-Shark/algobaro-api/assets/113650170/011959cc-09a9-468d-853b-e7c20b13c9e8)

- [Deploy Link](https://algobaro.vercel.app)
- [GitHub Wiki](https://github.com/1e5i-Shark/algobaro-api/wiki)
- [FE Repository](https://github.com/1e5i-Shark/algobaro-fe)
- 서비스 배포 링크 - [Link](https://algobaro.vercel.app)
- 해당 프로젝트에 대한 자세한 정보 - [GitHub Wiki](https://github.com/1e5i-Shark/algobaro-api/wiki)
- 프로젝트 웹 클라이언트 Repository - [GitHub Repository](https://github.com/1e5i-Shark/algobaro-fe)
- 소켓 기본 연결 테스트 클라이언트 Repository - [GitHub Repository](https://github.com/hyoguoo/socket-test-client)

<br>

Expand Down
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;
}
}

0 comments on commit 79c8990

Please sign in to comment.