I cannot subscribe using PubNubEmber. I've verified the publish & subscribe keys. In my PN app I've enabled presence. I have not enabled access manager yet as I wanted to make sure everything was working first. It's not:
GET http://ift.tt/1OXeiMM 400 (Bad Request)
That repeats until I kill the app. Has anyone run into this and figured out what the problem is? Is there something wrong with the request string? The key in the request is correct. (Without Xs, of course.)
Here's the very minimal code so far. What I do wrong??
const App = Ember.Application.create();
const user_id = "User " + Math.round(Math.random() * 1000);
App.PubNub = PubNubEmber.extend({
cfg: {
subscribe_key: "pub-c-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
publish_key : "sub-c-yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
uuid : user_id
}
});
App.ApplicationController = Ember.Controller.extend({
needs : ["pubnub:main"],
channel : "foobar",
newMessage: "",
userId : user_id,
messages : Ember.A(["blah blah blah"]),
users : Ember.A([]),
init: function() {
let pn = this.get("pubnub");
let chan = this.get("channel");
pn.emSubscribe({channel: chan});
// with everything below commented out I still get the errors
pn.on(pn.emMsgEv(chan), function(payload) {
this.get("messages").pushObject(payload.message);
}.bind(this));
pn.on(pn.emPrsEv(chan), function(payload) {
this.set("users", pn.emListPresence(chan));
}.bind(this));
pn.emSubscribe({channel: chan});
pn.emHereNow({channel: chan});
pn.emHistory({channel: chan, count: 100});*/
},
actions: {
publish: function() {
this.get("pubnub").emPublish({
channel: this.get("channel"),
message: `[${this.get("userId")}] ${this.get("newMessage")}`
});
this.set("newMessage", "");
}
}
});
Aucun commentaire:
Enregistrer un commentaire