Browse Source

reviewed code added comments to publish function and added Channel-LosAngeles to subscriptions

tags/0.0.1^2
K Rob 3 years ago
parent
commit
9dff6d5dfb
2 changed files with 13 additions and 6 deletions
  1. 12
    5
      frontend/src/components/ProfileCardList.vue
  2. 1
    1
      frontend/src/services/chat.service.js

+ 12
- 5
frontend/src/components/ProfileCardList.vue View File

@@ -106,14 +106,21 @@ const view = pid => {
106 106
     router.push({ path: `/matches/${pid}` })
107 107
 }
108 108
 const chat = async pid => {
109
+    // create a chatter reference from the current profile
109 110
     const chatter = currentProfile.chatter
110
-    console.log('mock sender:', pid)
111
-    const res = await chatter.publish(chatter.subscriptions[0], {
112
-        title: 'pong',
113
-        description: 'This is my first realtime message!',
111
+    // console.log('mock sender:', pid)
112
+    
113
+    /**  publish a new message to the chatter with the channel and the message
114
+     *  
115
+     *  title is optional
116
+     */
117
+    const res = await chatter.publish(chatter.subscriptions[1], {
118
+        title: 'New Message',
119
+        description: 'This is the start of a chat conversation!',
114 120
     })
121
+    // PubNub response will be a timecode of when the message was published
115 122
     console.log('res:', res)
116
-    console.log('channels:', chatter.subscriptions)
123
+
117 124
     //router.push({ path: `/chat/${pid}` })
118 125
 }
119 126
 const pass = () => {

+ 1
- 1
frontend/src/services/chat.service.js View File

@@ -66,7 +66,7 @@ class Chatter {
66 66
         this.uuid = null
67 67
 
68 68
         // Setup the main channel
69
-        this.subscriptions = [MAIN_CHANNEL]
69
+        this.subscriptions = [MAIN_CHANNEL, 'Channel-LosAngeles']
70 70
         this.listeners = {
71 71
             status: async e => {
72 72
                 await this.publish(this.subscriptions[0], testMessage)

Loading…
Cancel
Save