Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-Side can't run #8

Open
warut-k opened this issue Jun 19, 2014 · 2 comments
Open

Client-Side can't run #8

warut-k opened this issue Jun 19, 2014 · 2 comments

Comments

@warut-k
Copy link

warut-k commented Jun 19, 2014

Hi

I have run server side with following code, its can run perfectly
//////////////////////////////////Server.js ///////////////////////////////////////////////////////
var port = 8080,
app = require('express')(),
io = require('socket.io').listen(app.listen(port)),
logger = require('winston'),
program = require('commander');

logger.cli();
logger.default.transports.console.timestamp = true;

program.version('0.1')
.option('-p, --port [num]', 'Set the server port (default 8080)')
.option('-H, --disableheartbeats', 'Disable heartbeats')
.parse(process.argv)

var server = "localhost";
if(program.args.length==1) {
server = program.args[0];
} else if (program.args.length==0) {
logger.warn("Defaulting to localhost.");
}

if(program.port) {
logger.info("Setting port to " + program.port);
port = program.port;
}

if(program.disableheartbeats) {
io.set("heartbeats", false)
}

io.set("log level", 0);

app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});

var connectedUsersCount = 0;
var messagesPerSecond = 0;

io.sockets.on('connection', function(socket) {
connectedUsersCount++;

socket.on('chat', function(data) {
    //logger.info("chat message arrived"+data.text);
    io.sockets.emit('chat', {text:data.text});        
    messagesPerSecond++;
});

socket.on('disconnect', function(data) {
    connectedUsersCount--;
});

});

setTimeout(logStatus, 1000);

function logStatus() {
setTimeout(logStatus, 1000);

logger.info("users: " + connectedUsersCount + "\tmessagesPerSecond: " + messagesPerSecond);
messagesPerSecond = 0;

}

/////////////////////////////////////////////////////////////////////////////////////////

And also run the Client Side (Java Code) , i got this error. Can anyone help me.

---------------- CONCURRENCY 1 ----------------
Exception in thread "Thread-0" java.lang.NoClassDefFoundError: com/netiq/websocket/WebSocketClient
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.websocketbenchmark.client.SocketIOLoadTester.makeConnections(SocketIOLoadTester.java:138)
at org.websocketbenchmark.client.SocketIOLoadTester.run(SocketIOLoadTester.java:92)
Caused by: java.lang.ClassNotFoundException: com.netiq.websocket.WebSocketClient
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more

Thank you very much.
Wa

@drewww
Copy link
Owner

drewww commented Jun 19, 2014

Are you using the most recent version of socket.io? The websocket library that the client uses doesn't seem to work with socket.io 1.0 and I haven't had time to reverse engineer their new protocol to make this work.

@warut-k
Copy link
Author

warut-k commented Jun 20, 2014

Thank you for your answer. Yes, I used socket.io version 1.0.5

Thank you
Wa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants