Socket.io

    socket.io 실시간 chat API 서버 (Node.js, Socket.io, Redis)

    socket.io 실시간 chat API 서버 (Node.js, Socket.io, Redis)

    이전 포스팅을 봤을 때, node-multiroom-chat 레포지토리에 대한 내용만 기술하고, HJ커뮤니티에서 마무리 했던 ChatServer 레포지토리의 대한 내용을 기술하지 않아서 이번 기회에 포스팅 하게되었습니다. https://github.com/geun9716/ChatServer GitHub - geun9716/ChatServer: A Template ChatServer using socket.io, cluster, redis A Template ChatServer using socket.io, cluster, redis - GitHub - geun9716/ChatServer: A Template ChatServer using socket.io, cluster, redis github.com ..

    socket.io 실시간 chat 구현 (react - Node.js) - (2)

    socket.io 실시간 chat 구현 (react - Node.js) - (2)

    다음은 앞서 설명했던 단계들이 socket.io에서 어떻게 구현되어 있는지를 알아보겠다. 클라이언트단은 React.js 서버단은 Node.js를 사용하였다. 1. 소켓 생성 : 클라이언트는 socket.io-client에서 server의 IP와 port를 넣고 변수를 생성하면 된다. 클라이언트 - socket() //./component/socket.js import React from 'react'; import io from "socket.io-client"; // import { SOCKET_URL } from "config"; export const socket = io('localhost:5000'); export const SocketContext = React.createContext(); ..

    socket.io 실시간 chat 구현 (react - Node.js)  - (1)

    socket.io 실시간 chat 구현 (react - Node.js) - (1)

    채팅과 같은 통신 시스템은 2가지 Protocol 방식으로 나뉘어 진다. 2가지 방식에 대한 자세한 설명은 다음을 참조하기 바란다.(https://roothyo.tistory.com/5?category=952607) 간단하게 설명하자면, TCP - 신뢰성 있는 통신을 제공 - UDP에 비해 시간이 더 걸림. - Stream 방식으로 통신 - smtp, http, ... UDP - TCP에 비해 지연시간이 거의 없음. 주로 반응속도가 중요한 시스템에 적용. - 신뢰성 있는 통신을 제공하지 못함. - DataGram 방식으로 통신 - 게임, 동영상, ... 등 실시간 채팅은 주로 TCP로 구성되며 위에 있는 메소드의 대한 각 설명은 다음과 같다. socket() : 소켓 생성 bind() : 소켓에 주소 할..