Browse files

Use io.connect; Fix sendMessage method

  • Loading branch information...
1 parent 5e7569d commit dac3d49cf5dceeee8c4e15cf821360b6142d4b53 @kaborso kaborso committed Sep 10, 2011
Showing with 7 additions and 12 deletions.
  1. +7 −12 public/javascripts/app.js
View
19 public/javascripts/app.js
@@ -1,14 +1,14 @@
(function() {
- var socket = new io.Socket(config.address, {port: config.port, rememberTransport: false});
+ var socket = new io.connect('http://localhost:3000');
//var socket = new io.Socket("http://127.0.0.1/", {port: "3000", rememberTransport: false});
socket.on('connect', function() {
- socket.send({ event: 'initial' });
+ socket.emit('initial', { event: 'initial' });
});
- socket.on('message', function (message) {
-
+ socket.on('initial', function (message) {
+ console.log(message);
switch(message.event) {
case 'initial':
console.log(message.data);
@@ -20,21 +20,16 @@
}
});
- socket.connect();
-
- var SocketProxy = function() {
-
- var sendMessage = function(mySessionId) {
+ var SocketProxy = function(){}
+ SocketProxy.sendMessage = function(mySessionId) {
socket.send({
event: 'message',
data: {
boo: "awesome"
}
});
};
-
- }();
-
+
console.log(SocketProxy);
$(document).ready(function(){

0 comments on commit dac3d49

Please sign in to comment.