first of all thanks for read this post.
I nedd connect to a SocketIO from windows phone 8 and i dont know how to do it, If someone know it please post a solution, thanks for read this.
PD.: I used SocketIO4Net but i cant add the nudget to my project.
I used a different library, SockeIOClientDotNet, I installed through the NuGEt manager interface.
In order to connect to a nodeJs server I did this and it worked:
public Socket socket;
public theConstructor(){
this.InitializeComponent();
socket = IO.Socket(EVENT_CONNECT,()=>{
socket.Emit("xyz", "a message sent to nodeJs");
});
}
Related
We try to move node.js restful api to GCP. MySql is running normally as SQL instance. I have successfully deployed node.js app as App Engine service. I can see it works ok as GET request is comming through ok, with status 200. However, I am unable to connect to MySQL from this app, as I can see that when I try to init mysql-password-store (I am using passwordless.js library for authentication), I am not able to come through. Error is this:
Error: Server does not support secure connection at /workspace/node_modules/passwordless/lib/passwordless/passwordless.js:445:10
I believe the reason is in fact that I am running http server, as opposed to https server in my express (node.js) app.
I was able to get to work custom domain, thinking this will solve SSL issues, however the problem I believe lies in somewhere between eypress and mysql.
Can someone please explain how can I run https server on AppEngine. I don't understand how or where to get certificates to pass into part for creating https server:
const httpsOptions = {
key: fs.readFileSync(process.env.PATH_PRIVKEY),
cert: fs.readFileSync(process.env.PATH_FULLCHAIN)
};
https.createServer(httpsOptions, app).listen(port, err => {
if (err) {
throw err;
}
winston.info(
`********** App running on port: ${port} - https *** in mode:${process.env.NODE_ENV} on host:${process.env.NODE_HOST} ********** `
);
});
I am able to run app as http server from localhost and connect to GCP SQL MySql instance. . .
In case someone hits similar problem, I'll briefly decribe how we got it solved. We moved node.js (REST api with express) to Cloud Run service, and hit same problem . . Routes that were calling stored procedures in our DB (MySql instance in Cloud SQL) could not communicate until we did following:
Cloud Run - Service - Service Details - Edit and deploy - Connection - - here the connection to db instance needs to be inserted into Cloud SQL Connection
In our node app . . connection to mysql (via knex) should be made with socketPath (unix way) . . instead of classic IP,PORT way. We are still using public IP at MySql.
in node.js (express) we set up http server and not https. Seems to me that gs takes care of the cerificates.
Maybe someone find this helpful.
I am getting this server error when publishing my site to our host.
I cannot replicate this error with any of our other sites on this hosting service. I have also tried using the SslMode="none" within the connectionstrings of the webconfig file, but that also crashes as the webconfig xml does not recognize the SslMode field.
Any thoughts?
I had the same issue and for me worked when I added SslMode=none into my connection string, see how I did =>
"ConnectionString": "Server=domain;Database=xxx;Uid=xxx;Pwd=xxx;UseAffectedRows=False;AllowUserVariables=True;SslMode=none;"
I'm not able to establish a connection to my MySQL server.
This is the connection string:
jdbc:mysql://<my_IP_address>:1005/rs_pm
This is the line of code:
var conn = Jdbc.getConnection(connString, mysql_user, mysql_pass);
I've been able to write a native Java program using JDBC and it connects just fine using the same connection string/username/password. (Yes, I know the port is non-standard but that's how I have it configured and it works with the native Java app).
The weird thing is, I'm looking at my router logs and when I try to connect with a native Java app I can see the traffic coming in. But when I run the script in G Apps I don't see any packets being received by Google IP addresses.
Is it just me? Is there a problem somewhere?
Thanks in advance.
Update So it appears that if I use the standard mysql port (3306), the connection works fine. It seems as though something in Google Apps won't try an outbound connection on the port I had specified (1005), or any other ports I tried. Perhaps the jdbc connector they use only supports port 3306? I will file a bug since this behavior isn't documented anywhere.
JDBC connection to a database server only supported to ports 1025 and higher.
Access HTTP response headers in for flash.net.URLLoader object?
I found the above question that seemed to have a solution for an AIR application but not for my non-AIR flex application? Is it even possible?
If it is not possible in native as3 you could parse it yourself. Open a socket connection using the Socket class and connect to the url/domain using port 80.
After you connected you can read out the socket buffer and parse the string to get the response headers.
You can follow the Telnet example on http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b0-181c51321220efd9d1c-8000.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7cf7 and change the port numbers to 80.
I believe I was reaching a little beyond the abilities of a non-air flash application. I wound up retrieving the headers server side and then using the external interface callback functionality to use what I knew about the headers flex-side.
I'm new to node.js, dived into it during the last weekend and had fun with various examples and small tutorials.
Now I'd like to start a little project for my local area network and have a few questions to get myself into the right direction.
Setup:
I've got a server service running on my lan. It's possible to communicate with that service via TCP and/or HTTP (it's possible to enable or disable TCP or HTTP or both of them) on a specific port and sends and receives data via JSON on a request.
What I basically want to do is to create a webinterface based on node.js for that service, to receive and send JSON data with a webbrowser from and to that service.
Problem:
I already do know how to setup an http server based on node.js. But right now I'm stuck in finding an idea how to create a client based on node.js which stands between the service and the webbrowser client to pass through data from client to server and vise versa. Something like a router or proxy.
Here is a basic scheme based on the client's (webbrowser) point of view:
Send: Webbrowser requests -> node.js routes -> service receives
Receive: Webbrowser receives <- node.js routes <- service responds
Questions:
- Go for TCP or HTTP? (maybe disabling the HTTP Server would spare some ressources) - maybe already answered by this post
- Are there any node.js packages that would fit my needs?
- Go for a framework (expressions?) or would plain node.js be just enough?
- Any hints appreciated :)
edit:
- Is it possible to bind a network device like eth0 inside node.js instead of defining the ip address?
Thanks for your help && best regards
cefra
There's no reason why you can't have a REST HTTP service.
Use something like express to handle routing.
If I understand your problem correctly then you have a webservice written in "foobar" on a TCP port somewhere you can connect to with node.
So if your using express you would write something like
app.get("/resources/", function(req, res) {
var socket = new net.Socket();
socket.connect(port, host, function() {
socket.on("data", function(json) {
res.contentType("json");
res.send(json);
socket.end();
});
socket.write(...);
});
});
So basically you've written a http middleman that contacts your service over TCP then writes the data down the response of your HTTP request.