Kaynağa Gözat

connecting to pubnub but throwing an error on the publish

tags/0.0.1^2
K Rob 3 yıl önce
ebeveyn
işleme
d56c511c50

+ 10
- 8276
backend/package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
backend/package.json Dosyayı Görüntüle

@@ -43,4 +43,4 @@
43 43
         "nyc": "^15.1.0",
44 44
         "sinon": "^11.1.2"
45 45
     }
46
-}
46
+}

+ 914
- 7794
frontend/package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 21
- 0
frontend/src/components/ProfileCardList.vue Dosyayı Görüntüle

@@ -36,6 +36,7 @@ section.profile-card-list
36 36
                         h4 {{ profile.name }}
37 37
                         nav.swipe_icons
38 38
                             button(@click="view(profile.pid)") view
39
+                            button(@click="chat(profile.pid)") chat
39 40
 </template>
40 41
 
41 42
 <script setup>
@@ -44,6 +45,7 @@ import {
44 45
     updateQueueByProfileId,
45 46
     fetchMembershipsByProfileId,
46 47
     postMembershipByProfileId,
48
+    currentProfile,
47 49
 } from '../services'
48 50
 
49 51
 const router = useRouter()
@@ -102,6 +104,25 @@ const accept = async () => {
102 104
 const view = pid => {
103 105
     router.push({ path: `/matches/${pid}` })
104 106
 }
107
+const chat = pid => {
108
+   
109
+    const chatter = currentProfile.chatter
110
+    // chatter._listenFor('hello_world')
111
+    chatter._subscribe(['hello_world'])
112
+    chatter.publish({
113
+    channel: "hello_world",
114
+    message: {"text": "This is my first realtime message!"}
115
+  }).then((publishResponse) => {
116
+    console.log(publishResponse);
117
+    });
118
+    
119
+    
120
+
121
+
122
+
123
+console.log('chatter', chatter.subscriptions)
124
+    //router.push({ path: `/chat/${pid}` })
125
+}
105 126
 const pass = () => {
106 127
     const targetId = props.profiles[0].pid
107 128
     updateQueueByProfileId(props.pid, targetId, true)

+ 7
- 2
frontend/src/services/chat.service.js Dosyayı Görüntüle

@@ -1,3 +1,4 @@
1
+import { processExpression } from '@vue/compiler-core'
1 2
 import PubNub from 'pubnub'
2 3
 
3 4
 /** 
@@ -18,11 +19,15 @@ const providerMethods = {
18 19
  * Breaking out as much pubnub specific flavor
19 20
  */
20 21
 const setupPubnub = async uuid => {
22
+    const publishKey = 'pub-c-73f35484-396f-47ff-b4b6-45bed079fd3b'
23
+    const subscribeKey= 'sub-c-6cb7f5d0-94e2-11ec-b249-a68c05a281ab'
24
+    // console.log('publishKey: ' , publishKey)
21 25
     if(!uuid) return console.error('no pubnub uuid set')
22 26
     
23 27
     const pubnubClient = await new PubNub({
24
-        publishKey: import.meta.env.VITE_PUBNUB_PUBLISH_KEY,
25
-        subscribeKey: import.meta.env.VITE_PUBNUB_SUBSCRIBE_KEY,
28
+        publishKey: publishKey,
29
+        subscribeKey: subscribeKey,
30
+        logVerbosity: true,
26 31
         uuid
27 32
     })
28 33
     // Pass pubnub specific methods to our placeholder obj

+ 1
- 1
frontend/src/services/login.service.js Dosyayı Görüntüle

@@ -102,7 +102,7 @@ class Login {
102 102
     }
103 103
     setupChatter() {
104 104
         this.chatter = new Chatter()
105
-        const testAccountUUID = import.meta.env.VITE_TEST_ACCOUNT_UUID
105
+        const testAccountUUID = '4523489'
106 106
         this.chatter.setup(testAccountUUID)
107 107
     }
108 108
 }

Loading…
İptal
Kaydet