Flutter not showing all Pusher events sent from debug console, and showing none sent from Laravel - laravel

I am trying to show Pusher notifications in Flutter. I've set everything up and tested it with Debug console. I've noticed that, although the console itself says that, as data, you can input
{ ... } or a string
I don't get anything if it's not a json format.
Examples that work:
{"key": "value"},
{"key": 123}
Examples that do not work (Pusher says that events are sent successfully):
Test
"Test"
Why is it that some of these work and other do not?
The goal is to have Laravel send data to Pusher and get it in Flutter, but I get nothing from Pusher since the format is probably wrong, especially because Laravel's broadcastWith function requires that you return an array. I've tried returning my object in an array, as well a json encoded object in an array, but nothing gets received in Flutter.
Has anyone dealt with this, and could I get it to work?

This seems like it could be a limitation of the flutter library in use. Certainly, if the Pusher debug console it showing that the events are being sent to the channel then it indicates an issue with the binding/consumption of events on the client side.
You may need to reach out to the flutter library maintainer for assistance.

Related

Cant figure out, why i get a 403

i try to setup the youtube api but i get a 403.
I tried to setup several times- without success.
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&id=-DIJvggBrg8&key=xyz
Maybe someone is able to help me or even login to the console for a setup?
The 403 error by itself is not of immediate use. Its attached error code (as I already pointed out above) sheds light on the things that happened.
The API responds to any query you make with a text (that is structured in JSON format). That response text contains the needed error code.
I suggest you to proceed with the following steps:
delete the old API key (right now it is still accessible!);
create a new API key and
run your API query using the new key and then post here the API response text.
Note that I checked the video -DIJvggBrg8 to which your query refers to with my own API key and got no error but a JSON text describing the video.

Chromecast sample sender application CastHelloText-chrome ends with error when trying to get session

I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.
Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.
Error appears when I do this steps:
Reload sender page, checking console if any device found.
Send the form by just pushing enter on input box (text is ignored).
Now a popup from Chromecast extension shows. Next there are two scenarios:
3a) I confirm casting to device by choosing one from the list, then I get this error message in console:
onError: {"code":"channel_error","description":"Error: Timeout","details":null}
3b) I just click somewhere else, I get this error:
onError: {"code":"cancel","description":"User closed popup menu","details":null}
Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.
When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.
Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.
Edit:
There were some syntactic errors that caused error message described above.
It seems like you are trying to use the data/control channel to send an image; please don't do that; that channel is not meant to be used for large data communications; in fact it cannot send anything which approaches or exceeds 64k. If your goal is to send images from your local machine, you would need to run a local web server on your local machine and serve images through the web server.
For and easiest tutorial you can have a look to this tutorial.
It is well explained in this tutorial.
Chromecast Sender application
There is no need to maintain session by yourself.
just add button and enjoy casting
mCastManager.addMediaRouterButton(mediaRoutebtn);
I found a source of my problem. There was something wrong in receiver code - syntactic and runtime errors, so I must admit that my code wasn't functional. Now its working in terms of launching application and getting session.
Unfortunate thing is that the error message generated by Chromecast extension didn't match the actual error - at least it was a bit confusing when I didn't know what's really happening on receiver side without ability to debug the code.

Is MediaProtocolCommand.Listener onCompleted called when it fails to load a video?

I am on purpose sending a video with a format that is not supported to my receiver app. I see the following message on the chromcast console:
[ 8.188s] [cast.receiver.ChannelOverWebSocket] Sending message:
["ramp",{"cmd_id":1,"type":"RESPONSE","status":{"event_sequence":10,"error":{"domain":"ramp","code":-2}}}]
from ws://localhost:8008/session?20
How do I receive that on my android app? I know onComplete for the MediaProtocolCommand.Listener is called when the video plays fine. The description makes it sound like it would also be called when it doesn't play or am I reading that wrong?
I've also tried looking into the MediaProtocolCommand returned by mMessageStream.loadMedia on a separate thread in an infinite loop and it never gets its hasError set to true. So what am I missing?
Thanks.
It appears that the Cast Android SDK isn't parsing these error messages correctly. In the sample Android client, the following exception is thrown with an invalid video URL:
MediaProtocolMessageStream(9088): error parsing message:
{"type":"RESPONSE", "cmd_id":1,"status":{"error":{"domain":"ramp","code":-2},
"event_sequence":377}} org.json.JSONException: No value for state
This looks like a bug and should be reported to Google.

How to debug a failed ajax request in google chrome?

I have a web application that crashes on ajax requests with google chrome (it works with every other web browser it was tested it). After debugging I found that the error is caused by response.responseText being undefined. The xhr object looks like this:
argument: undefined
isAbort: false
isTimeout: undefined
status: 0
statusText: "communication failure"
tId: 3
In debugger in the 'network' tab I get "(failed)", however all the headers are there and I can even copy into clipboard the response body (which is a valid JSON).
My question is - how can I debug this problem? Where to find additional information, what causes this request to fail?
I finally found the solution to my problem : AdBlocks, when it blocks an ajax request, it just says "communication failure".
The first thing I would double-check is that the data coming back from the response is valid JSON. Just pass it through a JSON validator like this online JSONLint: http://jsonlint.com/
I assume that you are using something like jQuery to make your AJAX requests. If so, then make sure that you are using the development version of that library. Now that you are using the development version (uncompressed) of the script, find the particular function that you are using (eg. $.ajax) and then, within the Chrome inspector, insert a breakpoint in the code where the AJAX response is first handled (eg. https://github.com/jquery/jquery/blob/master/src/ajax.js#L579). Then proceed to step through the code, inspecting various return-values to see exactly what is going wrong.
If you are not using something like jQuery to make AJAX calls, then I'd recommend using a framework to avoid possible cross-browser compatibility issues like you might be experiencing right now.

Ruby fb_graph app_request, or Request Dialog

I'm trying to do an app request, but my requests do not apear in the notification (the globe icon) and I don't know what to do more.
Just to confirm that i've done everything ok, I have followed the JS SDK Request Dialog example:
http://developers.facebook.com/docs/reference/dialogs/requests/
At first time it seems to work ok, and I have a list of my request, but can't see none in facebook.
What I have done so far:
used the fb_graph gem ( https://github.com/nov/fb_graph )
u = FbGraph::User.me(User.find(2).fb_access_token)
u.app_request!(:message => 'punk message')
After that if I do u.app_requests, I can see a list of requests.
As this seems not to work I after tried the Facebook JS SDK, and the result is the same.
My Question is: What am I doing wrong, or missing something?
Thank you
The more I'm around it, the more I'm favoring the Javascript SDK over server side code. Is there a reason for your app to require to do anything serverside, or can you accomplish the same thing client side? Can you give us an example of the Javascript code you tried that failed?

Resources