Giter VIP home page Giter VIP logo

chatserver's Introduction

ChatServer

이 프로그램의 기능

Netty 을 기반으로 TCP 프로토콜을 이용하고 데이터는 JSON 을 이용한 싱글 서버용 채팅 서버입니다. Spring Boot 에서 작동하기 때문에 Injection 을 이용할 수 있습니다.

이 프로그램을 만들게 된 동기

이 프로그램은 Netty 기반 UDT 프로토콜을 이용하고 데이터는 Protobuf 을 이용한 멀티 서버용 채팅 서버를 개발하면서 터득한 몇 가지 노하우를 공개하기 위해 만든 일종의 예제입니다.

개발환경

IntelliJ 에서 개발하였습니다.

라이센스

The Artistic License 2.0 입니다. 제약이 많은 라이센스이니 주의하여 주십시오.

간단한 테스트

git clone 을 한 뒤 maven 으로 package 를 만들어서 jar 파일을 실행하거나, IDE 에서 Spring boot 로 Run 하면 됩니다. (스프링 부트를 잘 모르시는 분을 위해 설명드리면) 이 때 실행되는 경로(Working Directory)는 프로젝트(모듈) 디렉토리로 설정해야 config/ 의 application.yml 설정 파일을 읽습니다.

서비스 실행 뒤, 두 개의 클라이언트(윈도우즈 내장 telnet 으로도 충분합니다)로 접속 후 아래와 같이 로그인-메세지 발송을 테스트 해봅니다.

1번 클라이언트

> telnet localhost 9812

{"method": "login", "userId": "test1", "password": "123456"}

2번 클라이언트

> telnet localhost 9812

{"method": "login", "userId": "test2", "password": "098765"}
{"method": "send", "content": "Send Message"}

채팅 룸을 만들거나 메세지를 보내는 것은 아래와 같이 룸 생성-메세지 발송을 테스트 해봅니다.

1번 클라이언트

{"method": "create_room"}

2번 클라이언트

{"method": "enter_room", "roomId": "(1번 클라이언트에서 응답으로 온 roomId)"}
{"method": "send_room", "content": "Test Message"}

채팅룸에서 나가는 것은 아래와 같은 명령을 이용합니다.

{"method": "exit_room"}

chatserver's People

Contributors

zepinos avatar

Watchers

James Cloos 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.