Git Product home page Git Product logo

signaling_java's Introduction

Singling_Java


이 프로젝트는 안전관리플랫폼 WebRTC 시그널링 서버 입니다.



프로젝트 정보

백엔드


spring boot 3.1.2
자바 버전 : openjdk 17 ( Corretto )
gradle

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-websocket' // 시그널링 서버 구축을 위한 websocket
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

웹소켓 : STOMP


프론트


html + javascript

자바스크립트 사용 라이브러리
simple-peer : 9.8.0 깃허브 링크
sockjs : 1.5.1 깃허브 링크
stompjs : 2.3.3 깃허브 링크


docker로 실행


  1. gradle build 실행
gradle build
  1. dockerfile이 있는 곳에서 docker build 실행
docker build -t signaling-java .
  1. docker run 으로 실행
docker run -d --rm -p 9700:9700 signaling-java
  1. 완료

RTCPeerConnection ( 일반 Peer 테스트 ) 간단 사용 방법


해당 코드는 /resources/static/RTCPeerConnection 에 있는 프론트 코드를 기준으로 설명드립니다.
index.html, peerConfig.js

  1. http://localhost:9700/RTCPeerConnection/index.html 들어간다.
  2. 임의의 룸번호를 입력 후, enter Room 버튼을 클릭하여 룸을 만들어준다.
  3. 다른 웹 브라우저를 오픈하여, http://localhost:9700/RTCPeerConnection/index.html 로 들어간다
  4. 위에서 입력한 룸번호를 입력 후, enter Room 버튼을 클릭하여 룸에 들어가준다.
  5. start Streams 버튼을 클릭하여, 상대쪽에 웹캠 정보를 WebRTC로 보내준다. ( 어느 브라우저를 선택해도 가능 )
  6. 아래에서, 서로의 웹캠이 보인다면 완료!

외부에서 웹캠 연결 방법

만약, 로컬 환경이 아닌, 외부에서 IP를 입력하여 들어와서 웹캠을 테스트 하고 싶다면 해당 방법을 사용하여, 설정 해줘야 한다.

  1. 크롬 에서 chrome://flags 페이지에 접속
  2. Insecure origins treated as secure 옵션에서 http://{내 아이피}:9700 ip 추가
  3. http://localhost:9700/RTCPeerConnection/index.html 에서 룸 번호 입력 후 웹캠이 열리면 완료

signaling_java's People

Contributors

mugon-jeong avatar musma-gregory avatar shbae-musma avatar

signaling_java's Issues

[FEATURE] 웹소켓 room 관리 기능

🔍 Description

어떤 기능을 만드나요? (기능 설명, 목표 등등)

cctv room 진입 요청

  1. CCTV

    • 시그널링 서버에서 long polling api를 호출하여 대기
    • long polling api에 camKey, roomId 데이터를 받아오고, 만약 시그널링 웹소켓에 접속하지 않았다면 접속
    • peer 생성하여 roomId,camKey를 이용하여 해당 웹소켓 룸에 offer, answer, iceCandidate 데이터를 주고 받는다.
    • CCTV 통신 완료
  2. 관리자 ( 앱 )

    • 해당 CCTV를 클릭하면 웹소켓 접속 , event-trigger api 를 호출하여 long polling 에 응답한다.
    • room에 입장후 peer 정보를 받는다
    • CCTV 화면 확인

cctv room 퇴장 처리

  1. CCTV

    • 시그널링 서버에서 long polling api를 호출하여 확인
    • long polling api 에서 룸 인원, camKey 확인
    • camKey로 peer를 끊고 , 룸 인원이 1명이하라면 웹소켓을 끊는다.
  2. 시그널링 서버

    • 웹 소켓 접속 인원, 퇴장 인원을 체크해주는 이벤트를 확인
    • 퇴장시에 해당 룸의 cctv에게 룸 인원, camKey 정보를 event-trigger 로 보내준다.

🔨 TODO

  • cctv room 진입 요청 long polling api 추가
  • cctv room 진입 요청 event-trigger api 추가
  • cctv room 퇴장 처리 long polling api 추가
  • room 상태 정보 저장 전역변수 추가
  • 웹소켓 입장, 퇴장 리스너 추가
  • 테스트용 프론트 페이지 작성
  • 테스트
  • 서버 재배포
  • postman에 등록

📚 Reference

기능 구현에 참고한 내용이 있나요? (블로그, 공식문서 등등)

테스트 페이지 확인 방법

  1. 크롬에서 chrome://flags 페이지에 접속
  2. Insecure origins treated as secure 옵션에서 http://59.20.93.135:9700 ip 추가
  3. http://59.20.93.135:9700/room/cctv.html ( cctv 역활 페이지 ) 를 접속하여 웹캠을 킨다.
  4. http://59.20.93.135:9700/room/app.html ( 앱 역활 페이지 ) 에 들어가 cctv 확인 버튼을 클릭하여 cctv 화면을 불러온다.
  5. 완료!

🔔 ETC

메모할 사항이 있나요? (다른 개발자가 봤을 때 참고하면 좋을 내용, PR에 전달할 내용 등등)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.