It's a Node.js app serving a React app. I'm using free dynos so the app should sleep after not receiving any request, but it seems to be always on. I checked the billing on Heroku and it's consuming a significant amount of hours.
I would be fine waiting for the app to load up, but it won't sleep. Perhaps it has something to do with socket.io constantly pinging the server while no client is connected?
I only find topics on how to prevent sleeping, totally opposite of my intention. I also have another socket.io app on Heroku, but that one does sleep like expected.
Edit: The app logs tell that there are two socket connections made at the same time every 30 minutes, my app seems to be pinged by a pinger. How to stop unknown pinger?
My Heroku app was actually being pinged by a pinger. I freed the app from the pinger by changing the app name. Isn't it bad that anyone can add an app to a pinger and the publisher has to change the app name?
Related
I run 4 dynos with nodejs app on it under same subdomain (Example: app.website.com).
I need to send to all my dynos request from other dyno app (other domain: admin.website.com), also nodejs app. All dynos should remove some cached data in memory on command from admin server.
If I send http request to app.website.com only one of the dynos get it (because of the load balancer).
In Herokus "common runtime" its neither possible to connect to individual dynos from the outside, nor can you send http requests from one dyno to another. (See https://devcenter.heroku.com/articles/dynos#common-runtime-networking). In Herokus private space on the other hand the later would be possible, because all dynos form a VPN. (See https://devcenter.heroku.com/articles/dynos#private-spaces-runtime-networking)
Instead of trying to send a cache purge event to all dynos using http, it would probably be a better idea to change the setup. You could use a central component, e.g. a message queue, to which both your admin dynos and your app dynos can connect. The admin app could then dispatch cache purge events, which your app consumes. If you don't want to expand your infrastructure unnecessarily, but you already have any other central storage (e.g. a database) connected, you could also use that.
I had a local bot which I wanted to test in WebChat client instead of Emulator. After researching for a while and failing to connect normally, I stumbled upon a package called offline-directline which helped me connect my local bot successfully. My directline runs on 4000, webchat runs on 3000 and local bot runs on 3979.
I took a peak in the network tab later and I see my client keeps making GET requests to /directline/conversations/ endpoint. At first I thought it happens when I am sending messages in my WebChat client but it keeps sending them repeatedly. Around 50 GET requests in a minute.
I am not sure if this is a normal behavior. Would really appreciate an input. Thank you.
We have embedded a Bot on a web page through the web chat channel, if the Bot is idle for 10 minutes or so and then a question is asked, the Bot does not respond to it, however when the same question is asked again immediately it responds as expected.
On investigating the network capture, we observed the response received when the question was asked for the first time was 500: Internal Server Error with message as "failed to send message"
Are you running the bot in Azure? If so, make sure you have "AlwaysOn" enabled; otherwise the web app will be unloaded if it's idle for a period of time. Check this for a similar problem.
Always On. By default, web apps are unloaded if they are idle for some period of time. This lets the system conserve resources. In Basic or Standard mode, you can enable Always On to keep the app loaded all the time. If your app runs continuous web jobs, you should enable Always On, or the web jobs may not run reliably.
You can read more about the web sites configuration here.
I am looking for a WebSocket-enabled PAAS service. So far I have only experimented on Heroku and it works quite fine. Would you recommend other services?
Side question: I'm slightly worried about the billing. In the case of Heroku, it seems that usage is calculated via the time dynos are busy. I guess that in case of a Websocket connection, there may be a lot of idle time in between data exchange, and it would be fully billed anyway. Is that correct?
Heroku will bill you for the time the dyno is up, whether or not it is being used at all.
We've used Pusher as a complete websocket service, which allows you to asynchronously publish events from your main Heroku app and off-load the websocket connections and event publishing to Pusher.
They charge based on the volume of websocket traffic, which might be cheaper if you have a small volume or peaky traffic, and don't want to pay for a consistent set of dynos needed to service your peak traffic.
I want to run my application in background when i click on windows button.
Basically I have some methods of XMPP and when I goes to background it changes its status and presence from online to offline. I want this to be run in background.
Just because of the status is offline I am not able to receive any toast notification from XMPP.
If any one has idea about XMPP then please help to resolve this as well.
Any help will be much appreciated.
Thanks,
Nishant
You cannot make your app run in the background. I think that other IM apps use a push mechanism. So you need a server, when you app is exited, you tell the server to make the user seem still online and when a message arrives for the user, you send a push notification to the device. Whne the user taps the push notifictaion popup, your app will be started.
On Windows Phone "normal" apps cannot run continuous in background. XMPP normally requires a persistent long living TCP/IP connection during your complete session.
There are different ways to solve this problem:
1. create a app which can run in background, e.g a location tracking app or voice app
Log off when your app goes in background, you will not receive any message until your login in foreground.
Log off when your app is in background and also use a background service which log on in the interval of eg. 30 minutes and checks for new messages. But that's far away from being realtime and the idea of XMPP ;-)
Use a combination of XMPP and Push messages. XMPP while you are in foreground and Push when you are in background.
create a proxy between your app and the XMPP server and use Push. This means your app does not create the XMPP connection iself. Your app tells only your "proxy server" to login user X now. Your "proxy server" creates the XMPP connection and it can stay there 24/7 connected, doesn't matter whether your app is in background or not. Your app can communicate with your "XMPP proxy" over push or any other protocol choose.
Which solution your choose depends on your unique requirements. For chat apps like WhatsApp a background service is normally not appropriate because your messages are delayed for up to 30 minutes and your are not available while the background service does not run. While for other business apps this may be fine.