Procházet zdrojové kódy

connecting to pubnub but throwing an error on the publish

tags/0.0.1^2
K Rob před 3 roky
rodič
revize
d56c511c50

+ 10
- 8276
backend/package-lock.json
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 1
- 1
backend/package.json Zobrazit soubor

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

+ 914
- 7794
frontend/package-lock.json
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 21
- 0
frontend/src/components/ProfileCardList.vue Zobrazit soubor

36
                         h4 {{ profile.name }}
36
                         h4 {{ profile.name }}
37
                         nav.swipe_icons
37
                         nav.swipe_icons
38
                             button(@click="view(profile.pid)") view
38
                             button(@click="view(profile.pid)") view
39
+                            button(@click="chat(profile.pid)") chat
39
 </template>
40
 </template>
40
 
41
 
41
 <script setup>
42
 <script setup>
44
     updateQueueByProfileId,
45
     updateQueueByProfileId,
45
     fetchMembershipsByProfileId,
46
     fetchMembershipsByProfileId,
46
     postMembershipByProfileId,
47
     postMembershipByProfileId,
48
+    currentProfile,
47
 } from '../services'
49
 } from '../services'
48
 
50
 
49
 const router = useRouter()
51
 const router = useRouter()
102
 const view = pid => {
104
 const view = pid => {
103
     router.push({ path: `/matches/${pid}` })
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
 const pass = () => {
126
 const pass = () => {
106
     const targetId = props.profiles[0].pid
127
     const targetId = props.profiles[0].pid
107
     updateQueueByProfileId(props.pid, targetId, true)
128
     updateQueueByProfileId(props.pid, targetId, true)

+ 7
- 2
frontend/src/services/chat.service.js Zobrazit soubor

1
+import { processExpression } from '@vue/compiler-core'
1
 import PubNub from 'pubnub'
2
 import PubNub from 'pubnub'
2
 
3
 
3
 /** 
4
 /** 
18
  * Breaking out as much pubnub specific flavor
19
  * Breaking out as much pubnub specific flavor
19
  */
20
  */
20
 const setupPubnub = async uuid => {
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
     if(!uuid) return console.error('no pubnub uuid set')
25
     if(!uuid) return console.error('no pubnub uuid set')
22
     
26
     
23
     const pubnubClient = await new PubNub({
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
         uuid
31
         uuid
27
     })
32
     })
28
     // Pass pubnub specific methods to our placeholder obj
33
     // Pass pubnub specific methods to our placeholder obj

+ 1
- 1
frontend/src/services/login.service.js Zobrazit soubor

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

Načítá se…
Zrušit
Uložit