I have got a question about Visual Studio and Node.js with socket.io and mongodb.
I'v been searching for a while now but i can't find anything about this combination.
I'm trying to setup a Windows App, this Windows App should connect to a nodejs server running with socket.io.
The NodeJS server is connected to a MongoDB, the point is that i can't connect the Windows App to socket.io.
Here is how it is setup:
NodeJS Server:
Server.js:
var app = require("express")(),
http = require("http").Server(app),
io = require("socket.io")(http),
db = require("mongoose"),
ServerPort = 80;
db.connect("mongodb://localhost/SomeDataBase", function(err){
if(err)
console.log("DB > error: %s", err);
else
console.log("DB > connected!");
});
http.listen(ServerPort, function(err){
if(err)
console.log("HTTP > error %s", err);
else
console.log("HTTP > running on %s", ServerPort);
});
io.on('connect', function(socket){
console.log("Connection from application accepted.");
socket.emit('test', "Message from socket.io server.");
});
Visual Studio App:
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test app</title>
<link href="css/default.css" rel="stylesheet" />
<script src="js/socket.js"></script>
</head>
<body>
<div id="mainview"></div>
<script src="js/main.js"></script>
</body>
</html>
Main.js:
var socket = io.connect();
socket.on('test', function(data){
mainview.innerHTML = data;
});
I keep getting XML error:
SCRIPT7002: XMLHttpRequest: Networkerror 0x2ee7.
I still can't seem to find where it's being blocked out... Does anybody has a fix for me?
via Mr.YellowMan
No comments:
Post a Comment