Conecting MQTT server from Meteor Galaxy - meteor

My application uses the perak/meteor-mqtt-collection package to connect to an MQTT server running on IP XX.XX.XX.XXX. Locally it works fine, but on galaxy it doesn't. It just doesn't seem to be connected to the MQTT server. Do I need any particular configuration to connect to another server?
Meteor.startup(() => {
let server = "mqtt://XX.XX.XX.XXX";
...
Events.mqttConnect(server, arrayTags, { insert: true });
});

Related

Xamarin.Forms app TcpClient Error on Connect with "No route to host" exception

I am having very strange issue. I have 2 application, one is just my proof of concept, the other one is my real app. Both are Xamarin.Forms applications supporting Android, iOS, and UWP.
Both of these apps use TcpClient to connect to my IP and Port# on another machine. But here is what happens:
My proof-of-concept app works fine, it can send and receive data
to/from that IP/Port#
I also use app TerminalEmulator on Android and Ping on iOS which allow you to ping the IP address. Both devices are able to ping the IP meaning the IP is visible to the devices
But, if I try to connect from my real app on same devices, I get "No route to host" exception
How come my POC app can connect, I can ping the host from my Android/IOS device, but I cannot connect from my real app and get this error:
This is how I try to connect
public override async Task<IList<RoomGuestModel>> GetRoomGuestAsync(string roomNumber)
{
using (TcpClient client = new TcpClient())
{
try
{
client.Connect(_tcpConnection.Address, _tcpConnection.Port);
}
catch(Exception ex)
{
}
...
...
// use NetworkStream to write message and read message
await myStream.WriteAsync(...);
...
await myStream.ReadAsync(...);
The problem was that I was using wrong IP address, once I provided correct address, I was able to connect

Deploy Go webserver to Google compute engine

I just started to test Google compute engine. Now I'm trying to deploy my Go (golang) application on it, so that it can be reached from outside. I use compute engine in favor of the app engine, since my application requires a MongoDB database.
I did the following:
create compute engine instance
setup up firewall so that port 1234 is open and IP is static
install MongoDB
upload my application
start
The application starts just fine. But I cannot reach it from outside if I open it in my browser with ip:1234. I also tried to start it on port 80 as root user, but this didn't work neither.
The server is configured as following:
{
"host": "localhost:1234",
"dbhost": "localhost",
"db": "dbname",
"logfile": "log"
}
When I'm using an apache server it servers port 80 and the page is displayed... OS is ubuntu 14.04.
The main simply adds some handlers to a mux and adds a FileServer to the public dir:
mux.Handle("/", http.FileServer(http.Dir(public_dir)))
// [...]
if err := http.ListenAndServe(cfg.Host, mux); err != nil {
panic(err)
}
So what's the issue here?
Try changing host from localhost to 0.0.0.0, because right now it's only listening to "inside" requests.

Unable to connect to the signalr hub when it is hosted in webserver

im bugged up with a issue in SignalR and breaking my head for the past 10 days.
I have the hub as a self host in a console application. It works fine when it is hosted in the local system as follows
$.connection.hub.url = 'http://localhost:8080/signalr';
$.connection.hub.logging = true;
$.connection.hub.start()
.done(function () { alert("Now connected!"); })
.fail(function () { alert("Could not Connect!"); });
The problem is when i host it in the server and try to access the hub url as
$.connection.hub.url = 'http://www.domainname.com:8080/signalr';
it always says could not connect.
if i browse the page in the server machine and try to connect the hub as localhost it works fine but unable to connect as domainname
i have done all the steps.
Added the port 8080 in the firewall
I have run the console app as admin
in the console app, i have given the server url as *:8080
please help me. im breaking my head now. is there anything that i need to enable in the server. the server is windows 2008 R2

Can't access port 8080 on EC2 (AWS)

I just started a new AWS EC2 instance. In the instance's security group I added a new rule to open port 8080. I also stopped the iptables service on the instance, per another post. So in theory this port should be wide open.
I started my RESTful service on 8080 and was able to access it locally via curl.
When I come in with curl remotely I get an error saying it couldn't connect to the host.
What else should I check to see if 8080 is truly open?
I started my RESTful service on 8080 and was able to access it locally via curl.
What kind of technology is your RESTful service based upon?
Many frameworks nowadays listen on localhost (127.0.0.1) only, be it by default or by means of their examples, see e.g. the canonical Node.js one (I realize that port 8080 hints towards Java/Tomcat, anyway):
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
The log message generated by starting this is Server running at http://127.0.0.1:1337/ - the emphasized part is key here, i.e. the server has been configured to listen on the IP address 127.0.0.1 only, whereas you are trying to connect to it via your public Amazon EC2 IP Address.

EC2- non responding http requests

I just installed my node.js app in a windows micro instance with security group quick-start and with http port enabled.
I opened the firewall in the instance and opened port 80, 443 for inbound and outbound both.
In spite of that, my http requests are not being honored by the node.js app.
From log I see that the app is connected to redis and mongo and socket.io is also started.
What's wrong ? why http requests are blocked ?
Have you by chance built your app on top of the Example Webserver as currently shown on the Node.js home page as well? The sample currently looks like so:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Either way your Node.js server might simply not be listening on the correct port/hostname combination - the Example Webserver listens on port 1337 (rather than the regular HTTP port 80) and on localhost only (rather than on the private/internal IP address which has been assigned to your EC2 instance) for example.
If these assumptions apply, you could achieve you goal by adjusting the listen() statement accordingly, see my answer to the related question Node.js Amazon EC2 example webserver - no result for an extended discussion, including a couple of variations regarding the flexible use of the server.listen(port, [hostname], [callback]).
Good luck!
Finally found the problem.
I introduced log4js and integrated this with express, as,
app.use(log4js.connectLogger(logger, { level: log4js.levels.ERROR }));
This created the problem. Somehow this was failing. Looks like it works only with DEBUG. After commenting this, it started working. Strange !!

Resources