2021-02-16(Tue)

ํ•ญ๋ชฉ

๋‚ด์šฉ

ํ•™์Šต ๋‚ ์งœ

2021-02-16(ํ™”)

ํ•™์Šต ์‹œ๊ฐ„

11:00~24:00

ํ•™์Šต ๋ฒ”์œ„ ๋ฐ ์ฃผ์ œ

Websocket, Backbone, Rails

ํ•™์Šต ๋ชฉํ‘œ

ChatRoom์„ ๊ตฌํ˜„ํ•œ๋‹ค.

๋™๋ฃŒ ํ•™์Šต ๋ฐฉ๋ฒ•

eunhkim๋‹˜๊ณผ ํŽ˜์–ด์ฝ”๋”ฉ์„ ์ง„ํ–‰ํ•˜์˜€๋‹ค.

์ƒ์„ธ ํ•™์Šต ๋‚ด์šฉ

URL ๋„ค์ž„ ์ปจ๋ฒค์…˜์—์„œ -์€ bad case์— ์†ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ๋˜์—ˆ๋‹ค. ์‹ค์ œ๋กœ PR์„ ๋ฆฌ๋ทฐํ•˜๋ฉด์„œ ๋Š๊ผˆ๋Š”๋ฐ -์€ ์Œ๋”ฐ์˜ดํ‘œ๋กœ ๊ฐ์‚ฌ์ฃผ์ง€ ์•Š์œผ๋ฉด ํ‚ค ๊ฐ’์œผ๋กœ ์“ฐ๊ธฐ ๋˜๊ฒŒ ์• ๋งคํ•˜๋‹ค..

https://api.gov.au/standards/national_api_standards/naming-conventions.html#:~:text=%2Fadd-product-,Query%20Parameter%20Names,_%20)%20character%20SHALL%20be%20used character SHALL be used)

์–ด์ œ ๊ตฌํ˜„ํ•ด๋‘” ๊ธฐ๋Šฅ์„ eunhkim๋‹˜๊ณผ ํ•ฉ์ณค๋‹ค. CSS, view ๊ตฌ์กฐ๋ฅผ eunhkim๋‹˜์ด ์žก์•„์ฃผ์…จ๊ณ , ๋‚˜๋Š” API์— ์ •์˜๋œ ๋™์ž‘๋“ค๊ณผ ์˜ˆ์™ธ์ฒ˜๋ฆฌ๋ฅผ 1์ฐจ์ ์œผ๋กœ ๊ตฌํ˜„ํ•ด๋’€๋‹ค.

์ดํ›„ ํ•จ๊ป˜ ๋ฒ„์ „์„ ํ•ฉ์นœ ๋‹ค์Œ ํŽ˜์–ดํ”„๋กœ๊ทธ๋ž˜๋ฐ์œผ๋กœ ์ฑ—๋ฃธ ๋ฉ”์„ธ์ง€ ์ฑ„๋„, API, ๋ Œ๋”๋ง๊นŒ์ง€ ๊ตฌํ˜„ํ–ˆ๋‹ค.

import consumer from "./consumer";
โ€‹
export function ConnectGroupChatChannel(message_collection, room_id) {
  return consumer.subscriptions.create(
    // ํ•˜๋‹จ ํ•ด์‹œ๋Š” rails์—์„œ ๋ฐ›๋Š” ํ‚ค๋ฐธ๋ฅ˜๊ฐ’
    {
      channel: "GroupChatChannel",
      room_id: room_id,
    },
    {
      connected() {
        // Called when the subscription is ready for use on the server
      },
โ€‹
      disconnected() {
        this.unsubscribe();
        // Called when the subscription has been terminated by the server
      },
โ€‹
      received(message) {
        message_collection.add(message);
        message_collection.trigger("scroll");
      },
โ€‹
      speak(current_user_message) {
        current_user_message["room_id"] = room_id;
        this.perform("speak", current_user_message);
      },
    }
  );
}

ํ•™์Šต ๋‚ด์šฉ์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ์ดํ‰

eunhkim๋‹˜๊ณผ ํŽ˜์–ดํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ•˜๋ฉด ๋ญ๊ฐ€ ๊ฐ์ฒด ์ง€ํ–ฅ์ ์ธ๊ฐ€, ์˜์กด์„ฑ์„ ๋‚ฎ์ถ”๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋Š”๊ฐ€, ๋ญ๊ฐ€ ๋” ํด๋ฆฐ์ฝ”๋“œ์ธ๊ฐ€๋ฅผ ๊ณ„์† ๊ณ ๋ฏผํ•˜๊ณ  ์–˜๊ธฐ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ๋‹ค. ๊ธ์ •์ ์ธ ์˜ํ–ฅ์„ ํ•œ๊ป ๋ฐ›๋Š”๊ฒŒ ๋งŒ์กฑ์Šค๋Ÿฝ๋‹ค :)

๋‹ค๋ฅธ ๋ชจ๋“ˆ์˜ PR๋“ค์„ ๋ฆฌ๋ทฐํ• ๊ฒŒ ๋„ˆ๋ฌด ๋งŽ๋‹ค! ๋ฆฌ๋ทฐ๋ฅผ ๊ฑฐ๋“ญํ•˜๋ฉฐ ๋‹ค์‹œ๊ธˆ '๋ฆฌ๋ทฐํ•˜๊ธฐ ์‰ฝ๊ฒŒ ์ปค๋ฐ‹'ํ•ด์•ผ๊ฒ ๋‹ค๋Š” ๋‹ค์ง์„ ํ•˜๊ฒŒ๋˜์—ˆ๋‹ค. ์กฐ๊ธˆ ํž˜๋“ค์ง€๋งŒ ์—ด์‹ฌํžˆ ๋ฆฌ๋ทฐํ•˜๋ฉฐ ๊ฐ™์ด ์„ฑ์žฅํ•ด์•ผ๊ฒ ๋‹คใ…Žใ…Ž

๋‹ค์Œ ํ•™์Šต ๊ณ„ํš

  • Chat Room ๊ตฌํ˜„ ์™„๋ฃŒ

Last updated