-(void)combinedChatClient:(Bridge *)bridge
{
BridgeCallback* callback = [BridgeCallback callbackWithBlock:^(NSArray* args){
// First argument is the name of the sender
NSString* roomName = [args objectAtIndex:0];
// Second argument is the message
BridgeRemoteObject<RemoteChat>* channel = [args objectAtIndex:1];
NSLog(@"Joined channel: %@", roomName);
[channel message:@"\n\nsteve" :@"Bridge is pretty nifty!"];
}];
[bridge joinChannel:@"bridge-lovers \n\n" withHandler:[ChatObj new] andCallback:callback];
[bridge connect];
}
The error on the server side is TypeError: object is not a function
if I console log the callback object it looks like this
{ _address: [ 'client', 'lkadgdndgbclhcel', 'fzxc0WG0lV' ],
notify: [Function],
_operations: [ 'notify' ],
_bridge:
{ _context: { _bridge: [Circular], clientId: 'lkadgdndgbclhcel' },
_options:
{ redirector: 'http://redirector.getbridge.com',
secure_redirector: 'https://redirector.getbridge.com',
secure: false,
reconnect: true,
log: 2,
tcp: true,
prototype: [Object],
__super__: undefined,
host: 'localhost',
port: 8090,
apiKey: 'myprivateapikey' },
_store: { system: [Object], auth: [Object] },
_ready: true,
_connection:
{ bridge: [Circular],
options: [Object],
sockBuffer: [Object],
sock: [Object],
interval: 400,
clientId: 'bjbfdcfiicegefif',
secret: 'ibibamiecneihigc' },
_events: {} } }
TypeError: object is not a function
at Object.authObj.login (/Users/CameronMcGorian/Sites/node-examples/bridge-test/callbacks_server.js:9:4)
at Bridge._execute (/usr/local/lib/node_modules/bridge-js/lib/bridge.js:103:12)
at Socket.Connection.processMessage [as onmessage] (/usr/local/lib/node_modules/bridge-js/lib/connection.js:180:15)
at sock.start (/usr/local/lib/node_modules/bridge-js/lib/tcp.js:61:14)
at Socket.sock.onchunk (/usr/local/lib/node_modules/bridge-js/lib/tcp.js:41:7)
at Socket.sock.onchunk (/usr/local/lib/node_modules/bridge-js/lib/tcp.js:42:12)
at Socket.EventEmitter.emit (events.js:88:17)
at TCP.onread (net.js:397:14)
If I then try it with the Javascript call back Client all works fine and the logged callback object looks like this
{ [Function]
_reference:
{ _address: [ 'client', 'ecnagldjgekemall', 'rfumnicjwpdv' ],
callback: [Function],
_operations: [ 'callback' ],
_bridge:
{ _context: [Object],
_options: [Object],
_store: [Object],
_ready: true,
_connection: [Object],
_events: {} } },
_toDict: [Function],
callback: [Circular] }
Is there any special formatting that needs to happen on the Javascript of Objective C side?
BridgeCallback* callback = [BridgeCallback callbackWithBlock:^(NSArray* args){
// First argument is the name of the sender
NSString* roomName = [args objectAtIndex:0];
// Second argument is the message
BridgeRemoteObject<RemoteChat>* channel = [args objectAtIndex:1];
NSLog(@"Joined channel: %@", roomName);
[channel message:@"steve" :@"Bridge is pretty nifty!"];
}];
[remoteAuth login:@"steve" :@"bridge-lovers" :@"secret123" :[ChatObj new] :callback];
[bridge connect];
--Sridatta--
You received this message because you are subscribed to the Google Groups "Bridge" group.
To post to this group, send email to bridge...@googlegroups.com.
To unsubscribe from this group, send email to bridge-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/bridge-users/-/YBDdZvUNO6QJ.
For more options, visit https://groups.google.com/groups/opt_out.
To unsubscribe from this group, send email to bridge-users+unsubscribe@googlegroups.com.