C# Server closing/crashing if a client connects to it when the server lost focus (ex. screensaver is running)
By : user3849200
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I found what was crashing my server (it took me some time because I was lately focusing on the client programming, it is today when I returned to the server programming). As @Moo-Juice suggested, it is a problem related to accessing the UI. In fact here is the scenario that was causing the crash: The server starts It enters into an infinite loop listening for clients to connect. This infinite loop is in the backgroundWorker. A client connects to the server. I print a message on a textBox that a client has connected. //here is the problem To be able to establish point (4) I am using the backgroundWorker.ReportProgress method. code :
private void PrintString(string stringToPrint)
{
var myForm = Form1.ActiveForm as Form1;
myForm.backgroundWorker1.ReportProgress(1, stringToPrint);
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
textBox1.Text += (string)e.UserState;
textBox1.Text += Environment.NewLine;
}
|
Node.js express server on appfog: sessions lost on page refresh when using chrome on android
By : Talakadu
Date : March 29 2020, 07:55 AM
To fix the issue you can do Well I don't know what's wrong with AppFog, but I created an app and ran this code at Nodejitsu and I can confirm it works in Chrome @ Android 4.1.2: http://testforso.jit.su/
|
Getting data for user based on JWT in Node/Express
By : Nikita N.
Date : March 29 2020, 07:55 AM
Hope that helps This question is half about my code specifically, and half about the high-level view of actually getting data for a particular user from a node API. , Is this the correct idea? code :
app.use(function (req, res, next) {
var token = req.signedCookies.token
res.locals.user = jwt.verify(token, 'my-secret')
next()
})
|
Getting data from restful API in Node (server to server) Node/Express Using Request
By : apar sharma
Date : March 29 2020, 07:55 AM
like below fixes the issue If you look at the end of the documentation you cited, you will notice that the request is: code :
GET https://api.tradegecko.com/products
myRouter.route('/testRoute')
.get(function(req, res){
request({
method: 'GET',
uri: 'https://api.tradegecko.com/products',
headers: {'Authorization': 'Bearer ' + 'TOKEN HERE'}
}, function (error, response, body){
if(!error && response.statusCode == 200){
res.json(body);
}
})
});
|
Node/Express app-- how to change connection string (node-postgress) based on localhost vs. remote server
By : blemee
Date : March 29 2020, 07:55 AM
may help you . For that you should use the standard NodeJS environment variable - NODE_ENV. It should be set to development on your local machine. And on your production server it is usually defaulted to production, as it is on Heroku: NODE_ENV=production
|