How to disable or remove Socket.Io log message in user browser? - node.js

I made an app that use socket.io.
It's time to put in production.
Before that, i want to remove or disable all socket.io error log in Client Side( the browser of user, So by inspecting console, he will not see the error).
Error is available at this link below
https://i.stack.imgur.com/PMDib.jpg

console['error'] = function(){}
did the job before all others scripts.
Thanks

Related

Nodejs server randomly requires user input on console line to run

So I'm working on a web server to host a website to talk to a teradata database, but every now and then when I send a request from the website back to the server, it will do nothing until I focus the console and press any key. Does anyone know why this is and how I can fix it?
I'm using XMLHttpRequests on the website and using the default Nodejs http package on the server side. Let me know if you need more information about it that I haven't included here.
As it turns out this was an issue with CMD/Powershell select mode.

Email is not working in Live only in Node.js

I'm using the node to send the email and it works fine in Local but when I upload on AWS instance it's not working.
To send the Email I'm using the Node Mailer which is very common so I'm not putting the whole code but I'm sharing the Link and the code is 100% the same.
I'm getting below Error in live only.
Note: I Enable the Google less secure app also.
seems like they ask you to follow link in smtp server negotiations response, and probably fill captcha.
I'm not sure for less secure app, but for me creating application password for access email on this page
https://myaccount.google.com/apppasswords
worked properly both with nodemailer and Claws email client
You can try this:
Enable less secure apps - https://www.google.com/settings/security/lesssecureapps
Disable Captcha temporarily so you can connect the new device/server - https://accounts.google.com/b/0/displayunlockcaptcha
Finally I found the solution that It was related to AWS server config issue.
In AWS, EC2 -> Security Group I open all TCP port and tried and it's working fine now.

Meteor error message client-side

I'm using the framework Meteor (Node.js).
I get this error message in my web browser when my project page is loaded:
The connection to ws://localhost:3000/sockjs/622/u2zaukpp/websocket was interrupted while the page was loading.
Why is it occuring?
It happens every single time you reload the page or it gets reloaded by the server.
Basically the page is constantly receiving data from the server (collections data, methods, or simply a ping). Since it is constantly open and Meteor forces a reload on code change (or you did force one by reloading the page), your browser freaks out and shows you this error.
It can also happen if the Meteor process is killed.
Thus, expect to see this error a lot during development, you don't have to worry about it.

Showing a message on res.redirect in Express / Node.Js app

I currently use res.error('message'); to show a message on the page that I load using res.redirect(url); in my Express/Node.js app.
Is there another way of showing a message, if I don't want it to be error message, but something else?
Thanks!
res.redirect(url) will actually issue an HTTP 302 redirect which will cause your user's browser to make a brand new request for whatever page is specified by the value in the url variable.
If you want to show the user a message after the redirect, you would need to store that message somewhere that will persist between requests and then read it on the subsequent page load. This is often accomplished by storing the message in a cookie or in server-side session state and is often referred to as flash storage.
The express-flash middleware can help you with this, although I'm not 100% certain of its compatibility with Express 4.
You also might find this SO question helpful.
You could use one of the other res method to send the message:
send('message') or end('message') seems being the most appropriated.
You could otherwise display some page with .render (view, templateParam).
More details here, on express request documentation
Use flash. They provide templates for error, success and informational messages. Very useful if your users are coming in with web browsers.

node-webkit http.Server and page change

I write an application using node-webkit. I want to use HTTP for network communication between computers, running my app. Can I change current page without server restart if server was started from the page?
I thought about child process, but I want to shutdown the server with my application. I don't want to use special network request to the server to close it.
Can I change current page without server restart?
Can I save child process object while page changing?
Do you know other way to do this?
P.S. Sorry for my english.
I found the answer in the node-webkit documentation.
In node-webkit, you can basically do the same thing by using
window.location, you can install it in the onclick event of a link and
node-webkit will navigate to a new page when user clicks it. But by
doing this you would lose everything in window context, you can save
everything in cookies like old web pages, or you can save things in
the global variable, which resides in Node.js's context and will live
through your app.

Resources