Pubnub Publish and Subscribe key - pubnub

I am new to PubNub.com.
My problem is, when I give publish_key and subscribe_key as demo, my application works fine.
But when I give my original publish_key and subscribe_key, it stuck in a infinite loop.
Please help !

Related

Getting <#[object Object]>! error when creating first HelloWorld bot in Slack / Bolt

I'm trying to create my first HelloWorld bot following this official tutorial using Bolt (https://api.slack.com/tutorials/hello-world-bolt).
The code is almost unchanged from the tutorial (only changed 'hello world' to 'hello bae'), however the User name is not being returned properly.
Can someone spot the issue? Thankyou so much in advance!
Bug in Slack:
Based on the code shared above, you have created a new object user with properties user & channel.
Therefore, the correct syntax would be :
say(`Hello bae, and welcome <#${user.user}>!`);

Why did this discord.js mass role removal code stop working?

I have a bot that when given the command would remove a specified role from all members who had it. This worked relatively well until recently and I'm not sure why it has stopped now. It will remove the role from my profile but no others. I know there was a recent update but from what I can tell nothing should have affected this code. Here is the basic block of code that appears to not be working.
message.guild.members.cache.forEach(member => {
member.roles.remove(roleID)
})
I do not receive any errors. It just doesn't remove the role from anyone else but my own profile. Any help would be greatly appreciated.

Initiate message from bot in dialogflow

I want to get the welcome message from bot first in dialogflow. I am not sure how to do this. Any ideas on how to do this.
I tried reading about events in dialogflow as Default welcome intent uses "Welcome" event. But not able to find any solution.
As I opened up my bot framework, it should pop up "Hi, I am a virtual assistant. How can I help you?"
I am not sure of which bot technology you are using, but if your front end is in html/js, you may call a function like this:
Define it something like:
function myFunction(){
''here you may pass a parameter to your bot to display a pre-defined message. I am not going in details here, as I am not sure about the framework you are using.''
}
The onload (in body) will call myFunction(), everytime the page is refreshed.
P.s - I will update this answer once I get more details from your end. Since I am new here, please excuse in case of any issues.

Progressive Web Application receiving data to trigger notification

Hello i'm newbie and im hardly to understand this notification in service-worker, and because my knowledge isn't good yet then probably i will unable to explain my problem clearly.
so here's the code :
// triggered everytime, when a push notification is received.
self.addEventListener('push', function(event) {
console.info('Event: Push');
var title = 'New commit on Github Repo: RIL';
var body = {
'body': 'Click to see the latest commit',
'tag': 'pwa',
'icon': './images/48x48.png'
};
event.waitUntil(
self.registration.showNotification(title, body)
);
});
this is the code that trigger to POP the notification, what I do not understand is where the argument to accept/ receive the data ?
I've been searched a lot: https://auth0.com/blog/introduction-to-progressive-web-apps-push-notifications-part-3/ ,
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web
there's some new data JSON or from git-server or push api, but I still hardly to understand where's to accept the data.
sorry if you still do not understand what's my problem.
Here to make it simple what I want :
Let's say i make a button, and everytime i click the button it will value as 'True' and I want that 'True' value to pass into argument and trigger the push of notication in service-worker.
2nd questions: am I able to trigger notification with header or text in html ? since we can manipulate the text with DOM ?
am I able to trigger notification without GCM, or API cause I just want a simple notification in serivce-worker like above without passing much data.
If you give more advice or maybe notification without service-worker but real time , I am surely happy to read it but I hope Im able to understand.
There are basically two concepts involved that work well together but can be used independently. The first is the visible UI shown to a user that tells them information or prompts them for an action. The second is sending an event from a server to the browser without requiring the user to currently be active on the site. For full details I recommend reading Google's Web Push docs.
Before either of those scenarios you have to request permission from the user. Once permission is granted you can just create a notification. No server or service worker required.
If you want to send events from a server you will need a service worker and you will need to get a subscription for the user. Once you have a subscription you would send it to a server for when you want to send an event to that specific browser instance.
Once you receive a push event from a server you display the UI the same as in the first scenario except you have to do it from the service worker.

Client method not called in SignalR

I am using signal R 1.0 with c#
the issue is most of the time with IE(v 10) and sometimes with chrome(v 28).
My client methods are not being executed.
I have chat functionality and on page load in
$(document).ready(function(){
//here i call server method to create group between two users
});
chat.client.groupcreated = function(){} //this is not invoked
on server side i write Client.groupcreated()
It is working perfact in FF. More interesting thing is if i put a break point in my cs code at server side it works perfact in IE also
Oppss...... I was doing a silly mistake
In the server method to create group i was doing something like below
Groups.Add(connectionid1,groupname);
Groups.Add(connectionid2,groupname);
Clients.Group(strGroupName).hellworld(); //no users added yet to the group while this line executes
The problem with above code is adding members to the signalr group is actually asynchronous, so sending messages to that group immediately won't work as the adding members to group may have not yet finished.
Solution
Groups.Add(connectionid1, groupname).ContinueWith(t =>
Groups.Add(connectionid2, groupname).ContinueWith(t2 =>
Clients.Group(groupname).helloworld());
wait for the task to complete before calling client method
By the way, thanks for posting your comments

Resources