RealTime with pusher-js & nextjs? - next.js

I found Pusher-js docs is not very usefull to get start with, Is there any tutorial I can follow to learn exactly how the flow will look like?

The front end javascript will be the same: https://pusher.com/docs/channels/getting_started/javascript/ . If you're using Vercel, you can use their serverless functions for backend message triggering. I got it working with Python. Follow their instructions on how to add the Pusher server library https://vercel.com/docs/concepts/functions/supported-languages

Related

Generating Swagger Docs in Firebase Cloud Functions project

Is it possible to generate Swagger Spec file from function comments in firebase cloud functions? If so, how can we do it?
I see the cloud functions code to be more like serverless, so wondering if this is possible.
I haven't found an automatic way, but there are plenty of libraries to choose from.
I'm using express and nodejs in my Firebase Function implementations, and for me,
Swagger doc generation can be implemented via the following libraries:
https://github.com/scottie1984/swagger-ui-express
https://github.com/Surnet/swagger-jsdoc
You can find other libraries at:
https://swagger.io/tools/open-source/open-source-integrations/
This will create a new HTTP endpoint, which will serve an HTML page of a swagger doc.
There is not an automatic way to do this at this time. I think you could build your own but seems like it would be a lot of work.

Saucelab - webdriverio : sessionID for sauce dashboard

I am trying out wdio and saucelabs. I see way to https://wiki.saucelabs.com/display/DOCS/Setting+Up+Reporting+between+Sauce+Labs+and+Jenkins configure report by outputting the sessionID
I am not able to figure out how I can do using webdriverio javascript method.
can you point to some example if this is possible with javascript ?
WebdriverIO comes with a Sauce service that automatically integrates this for you: http://webdriver.io/guide/services/sauce.html
If you're interested in more details, I wrote a blog post about a similar method I used for integrating Jenkins and Browserstack.

How do I use firebase v3 in Ionic2 via npm?

I have this error in firebase/auth.js and firebase/database.js:
rollup: Use of eval is strongly discouraged, as it posses security risks
This must be error in firebase node_module! I can't understand what's going on.
It's working When I remove firebase.initializeApp(config)
But, having same error on adding above.
Using Firebase v3 in Ionic2 Via NPM is not working at all!! Had lot's of problems in their node module.
So, I found a solution.. follow the link below, where discussion has been made for similar problem.
https://forum.ionicframework.com/t/is-it-possible-to-use-firebase-v3-in-ionic-2/54387
And here is the direct link of solution ..
https://github.com/aaronksaunders/ionic2firebase3
Simply, do not use Firebase v3 in Ionic2 Via NPM, unless they fix problems in their firebase node module.

Firebase client on ReactNative

When using Firebase on ReactNative, it will show such error message:
can't find variable process
However, if I require firebase/lib/firebase-web.js manually, it will show:
can't find variable document
How can I resolve this?
I just went through the same issue while trying to use sockets.io in my react native app so hopefully I can help.
The reason that you cannot use firebase's node module is because there hasn't been a polyfill created yet for websockets support (which firebase is dependent on) in react native.
If you take a look at issue #619 in react native's repo you'll find the current discussion on creating a websockets api polyfill.
The way that we solved it is by using Jason's modified version of the sockets library and creating our own repo around just that file. Then we added the line below to our package.json dependencies.
"react-sockets": "crewapp/react-native-sockets-io"
The reason that Jason's version of the sockets.io client file works is because react-native is added as a user agent. You can find the code that makes this change at the top of the file:
window.navigator = {
userAgent: "react-native"
}
Once you've gone through these steps you should be able to require sockets.io / firebase as normal.
Just figuring it our. Pavan's answer is helpful, but it is not quite true when using with Firebase.
For firebase, please follow the steps:
Download the firebase-debug.js from wsExample. Or you can just install wsExample by npm and require the firebase-debug.js inside it.
Use badfortrains's forked React-Native:
"react-native": "git://github.com/badfortrains/react-native#WebSocket"
New the Firebase like this:
var firebase = require("../../firebase-debug.js");
var rootRef = new Firebase(Const.FB_ROOT);
Things should just work now!
I had issues with socket.io on React Native too, solution was to get notifications about new data and if data is big enough - get it by simple RESTfull request. in my case data was small enough to be sent all within notifications API.
I was using GCM service to send notification to phone from nodejs server. BTW, it uses less battery then socket connection and works great :)

protecting the URL where flash/flex app can be executed

Is there an easy copyprotection, so that I can define in code the URL where flash/flex app can be executed
Here is a detailed tutorial on how to achieve that:
http://active.tutsplus.com/tutorials/actionscript/quick-tip-lock-your-swf-to-a-specific-domain-name/

Resources