Git Product home page Git Product logo

snu-chat's Introduction

snu-chat

채팅 클라이언트 구현

주어진 채팅 서버( https://snu-chat2.herokuapp.com/ )를 이용하여, 채팅 클라이언트를 구현한다. 서버 endpoint는 다음과 같다.

signup

:POST /signup { name }

-> { key, name, createdAt }

login

:POST /login (auth_required) -> {success: true, name }

get rooms

:GET /rooms { name } -> [ { id, name, usersCount }, { id, name, usersCount }, { id, name, usersCount } ]

create room

:POST /rooms { name } -> { id, name }

### join room 따로 사용하실 필요 없이, 처음 채팅을 해당방에 칠 경우 자동으로 조인이 됩니다.

chatting list

:GET /rooms/:room_id/chats { createdAtFrom, createdAtTo, order }

-> [ { user, message, createdAt, }, { user, message, createdAt, }, { user, message, createdAt, }, ... ]

maximum 30 messages are loaded. You must use createdFrom, createdTo, order=(asc,desc) to load more messages.

for example,

{"_id":"5ddfae935f3e3500043a8da8","message":"","createdAt":1574940307945,"userName":"hihihihiihi"}

when last message is like that, you can load more messages by sending

https://snu-chat2.herokuapp.com/chats?createdAtFrom=1574940307945

When user is null, that message is special message. There are two types of special message, 'create room' and 'join room'. You must handle this message appropriately.

send message

:POST /rooms/:room_id/chats (auth_required)

-> { roomId, meesage, created }

  • auth_required 의 경우, /login 시 얻은 key를 http request header에 첨부하면 된다.
Authorization: Key sdfsdlfkje23rdsfsi9fergi

스펙

라이브러리

  • react 사용
  • react functional component 사용
  • fetch 사용
  • dayjs 사용해도되나, 사용하지 않아도 무방.
  • ui framework 1개 이상 사용.(material design, bootstrap...)
  • eslint 사용. airbnb | google (npx eslint --init)

기능

  • 가벼운 카카오 오픈채팅방이라고 보면 됨
  • 화면 로딩이 완료되고, localStorage 에 key가 저장되있을 시 /login으로 키가 valid한지 확인.
  • valid시 로그인 처리
  • 로그인 안 한 상태에서는 현재 방 목록을 보여주고 방에 들어갈 수 있음.(채팅은 불가)
  • 회원가입 버튼을 누르면, name을 입력할 수 있고 입력하면. 회원가입 및 로그인 완료.
  • 로그인 완료 시 방에 채팅 기능 활성화, 방 create 버튼 활성화.
  • 방 입장 시 채팅이 가능.
  • 3초에 한 번씩 서버 채팅 목록을 가져와, 새로운것이 있으면 업데이트 해줌.
  • 메시지 입력 완료 시, 서버에서 바로 채팅 목록 가져와서 refresh.

추가스펙

  • 로그아웃 기능
  • 방에 채팅이 30개 이상 쌓였을 경우, 위로 스크롤 할 시에 대화 추가 로드.
  • 오프라인 모드에서 적절한 에러 핸들링
  • 채팅 입력시 enter 와 shift+enter 구분해서 핸들링(enter -> 채팅 전송. shift + enter -> 엔터입력)

일정

  • 6월 14일 23:59:59 까지 etl을 통해 제출
  • 1일 늦을시 마다 5%씩 감점.

snu-chat's People

Contributors

realcom avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

snu-chat's Issues

안녕하세요 과제2 관련해서 질문사항이 있어 질문드립니다!

  1. 작성해주신 스켈레톤 코드를 보면 회원가입란이 있던데 이와 별도로 로그인 기능을 만들어야하는건지 궁금합니다!(회원가입할 때 서버에 요청하는 url이 /login이라고 돼있던데 별도로 로그인 기능을 만들지는 않아도 되는건가요?)
  2. 만약 로그인 버튼을 만들지는 않고 회원가입 기능을 이용해서 로그인을 하는거라면 기 생성한 동일한 아이디로 회원가입을 했을 때 로그인이 제대로 되지 않고 undefined라고 뜨는 것 같습니다.(서버쪽 코드관련한 이슈같아서 질문 드립니다ㅜ)
  3. 로그인 이력이 있을시 자동 로그인을 한다고 돼있는데 그냥 로컬스토레지 정보를 이용해서 브라우저 다시켰을 때 로그인이 돼있으면 되는건가요?(스켈레톤에 이미 구현돼있는 것 같은데 구현 기능 목록에 있어서 질문드립니다)
  4. 마찬가지로 메세지 입력했을 때 채팅모드 다시 가져오는 것도 스켈레톤에 이미 구현돼있는 것 같은데 더 구현할 필요가 없는건가요?
  5. 기능에서 로그인 완료시 방 목록에 있는 join버튼 활성화라고 돼있는데, 이 말의 뜻이 로그인을 하지 않으면 채팅을 못치는 것 뿐만이 아니라 아예 채팅방에 들어가서 채팅내역 자체를 볼 수 없게 만들어야한다는 뜻인지 궁금합니다.
  6. 마지막으로 추가기능에 오프라인 모드에서 적절한 에러핸들링이라고 돼있는데 혹시 무엇을 의미하는지 좀 더 구체적으로 알 수 있을까요?

안녕하세요! 과제2 로그아웃 관련해서 질문드립니다!

안녕하세요 웹프를 수강하고 있는 김우영이라고 합니다!

  1. 새로 업데이트된 ReadMe를 읽어보니 로그인을 할 때 화면 로딩이 완료되고 localStorage에 key가 저장돼있을 시 login으로 키가 valid한지 확인하라고 돼있는데 혹시 그러면 로그아웃할 때 name만 없애고 localStorage에서 key값은 클리어하지 말라는 의미인가요?(만약 key까지 클리어 한다면 key를 따로 적어놓은다음에 localStorage에 임의로 넣지 않는 이상 사실상 login기능이 무용지물이 될 것 같아서요!)
    왠지 로그아웃이라는 의미를 생각했을 때 다 클리어해야할 것 같긴한데 다 클리어하는 순간 login 기능이 사실상 없어질 것 같아서 질문드립니다ㅠㅜ

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.