diff --git a/app/javascript/packs/chatrooms.js b/app/javascript/packs/chatrooms.js index a72d582..a29046f 100644 --- a/app/javascript/packs/chatrooms.js +++ b/app/javascript/packs/chatrooms.js @@ -19,17 +19,18 @@ App['chatroom' + chatroomId] = App.cable.subscriptions.create({ connected: () => { }, received: data => { + console.log(data) } }) // Testing ActionCable -// const testBtn = document.getElementById('test-btn') -// testBtn.addEventListener('click', event => { -// fetch(`/chat_rooms/${chatroomId}/cable_testing` , { -// method: 'POST', -// body: JSON.stringify({}) -// }) -// }) +const testBtn = document.getElementById('test-btn') +testBtn.addEventListener('click', event => { + fetch(`/chat_rooms/${chatroomId}/cable_testing` , { + method: 'POST', + body: JSON.stringify({}) + }) +}) diff --git a/app/views/chat_rooms/show.html.erb b/app/views/chat_rooms/show.html.erb index fd9e62f..57f416c 100644 --- a/app/views/chat_rooms/show.html.erb +++ b/app/views/chat_rooms/show.html.erb @@ -1,3 +1,4 @@ +