Giter Site home page Giter Site logo

socketchatting's Introduction

socketchatting

개요

소켓 통신을 활용한 채팅방 기능 구현

사용 방법

클라이언트 실행 : Client_user/client-user에서 npm start 입력

테스트 서버 실행 : node_test_server에서 npm i ws 이후 node WebSocketEchoServer.js 입력

파이썬 서버 실행 : cd chat-server 에서 pdm run server

파이썬 클라 실행 : cd chat-server 에서 pdm run client

version 관리

1.0.0 - 중대한 변화가 있는 경우

1.1.0 - 고도화 작업 완료 시

1.1.1 - 유의미한 기능 변화가 있을 시

버그 수정은 version_hotfix로 간단하게 처리

초기 버전 기능 추가에 따른 버전 업그레이드는 불필요

Protocol

  • send : 클라이언트에서 보내는 메시지 / unicast : 서버에서 unicast로 받은 메시지 / broadcast : 서버에서 broadcast로 받은 메시지
  • type rule : ACTOR_DOMAIN_ACTION
  1. 닉네임 설정

    • send

      • type : CLIENT_NAME_SET

      • userName : string(max length = 10)

    • unicast

      • type : SERVER_NAME_SET

      • status : bool (true = "success" / false = "fail")

  2. 방 생성

    • send

      • type : CLIENT_ROOM_CREATE

      • roomName : string(max length = 30)

    • unicast

      • type : SERVER_ROOM_CREATE

      • status : bool (true = "success" / false = "fail")

    • broadcast

      • type : BROAD_ROOM_CREATE

      • roomID : number(int)

      • roomName : string(max length = 30)

  3. 방 조회

    • send

      • type : CLIENT_ROOM_GET
    • unicast

      • type : SERVER_ROOM_GET

      • roomList : [ { roomID : number(int), roomName : string(max length = 30), host : string(max length = 10) }, ... ]

        (TODO : roomList pagination 최적화)

  4. 방 참여

    • send

      • type : CLIENT_ROOM_JOIN

      • roomID : number(int)

    • unicast

      • type : SERVER_ROOM_JOIN

      • status : bool (true = "success" / false = "fail")

      • roomID : number(int)

      • roomName : string(max length = 30)

        ( TODO : userList )

    • broadcast (~님이 입장하셨습니다.)

      • type : BROAD_ROOM_JOIN

      • nickName : string(max length = 10)

  5. 방 퇴장

    • send

      • type : CLIENT_ROOM_EXIT
    • unicast

      • type : SERVER_ROOM_EXIT

      • status : bool (true = "success" / false = "fail")

    • broadcast

      • type : BROAD_ROOM_EXIT
      • nickName : string(max length = 10)
  6. 채팅 입력

    • send

      • type : CLIENT_CHAT_SEND

      • message : string(max length = 128)

    • broadcast

      • type : BROAD_CHAT_SEND

      • nickname : string(max length = 10)

      • message : string(max length = 128)

conditions

  • 방 생성 성공 시 자동 입장(방장)
  • 방장이 방 퇴장 시 방 삭제
  • 방 삭제 시 방장인지 확인

TODO

  • BROAD_ROOM_GET 삭제(완료)
  • SERVER_ROOM_CREATE 응답 시 roomID 값 필요(완료)
  • BROAD_ROOM_CREATE 응답 로비로 보내기
  • on_recv_client_room_exit의 is_host 얻는 로직 수정(완료)
    • exit_room과정에서 session의 roomId를 삭제하여 self.rooms[session.room_id]에서 키 에러 발생
  • ROOM_JOIN 응답 값에 roomId 필요

socketchatting's People

Contributors

john-kim93 avatar dleowns1102 avatar

Stargazers

 avatar

Watchers

 avatar

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.