Hi,
I do not understand why this block of codes is not working on Ubuntu 12.04
(server) but it's working fine on Windows 7 (home computer):
var WebSocketServer = require('websocket').server;
> var http = require('http');
> var fs = require('fs');
>
> var server = http.createServer(function(request, response) {
> response.writeHead(404);
> response.end();
> });
> server.listen(8080, function() {
> console.log('Server is listening to port 8080');
> });
>
> wsServer = new WebSocketServer({
> httpServer: server
> });
>
> wsServer.on('request', function(request) {
> var connection = request.accept('echo-protocol', request.origin);
> connection.on('message', function(message) {
> fs.readFile('info.txt', 'utf-8', function(err,data){
> if (err) {
> return console.log(err);
> }
> console.log(data);
> });
> });
> });
>
I want to get connection before my app start reading a file.
Thank you,
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.