I figured it out.
I use socket.io also between the Admin browser and the Admin server,
so when the user browser's sends a message to the admin's server, the 
server emit it  to the admin's browser.
similar flow goes when the admin want to send a message to a specific user 
(I keep the socket ids).

I am still considering splitting it into 3 apps, so the socket.io server 
will stand on it's own. 
any pro/cons about this?


On Saturday, April 21, 2012 7:54:32 PM UTC-7, josh wrote:
>
> I am building 2 separate express sites: 
> clients website - visitors can talk to me (the admin of the site) via 
> chat (1 on 1 only. they can't see each other). 
> admin website - for me, the admin, to see all current conversations 
> and the ability to reply to whatever user I want. 
>
> I am using socket.io to emit messages from the clients website to the 
> admin website. 
>
> Is there a way to update the Admin UI whenever the admin site receives 
> a message? 
> Is there a way from the UI to emit a message back to the client's 
> browser? 
> Is there a problem with the design of my sites? maybe i should have 3 
> separate apps and not 2 (so the socket.io server will stand on it's 
> own). 
>
> Any other alternatives/suggestions would be great. 
> Thanks! 
>
> this code is part of the Admin server: 
>
>   basket = {}; // holds a hash of sockets 
>
>   socket.on('msg', function (data) { 
>     socket.get('nickname', function (err, name) { 
>       console.log('Chat message by ', name, ' saying', data.text); 
>       var to = basket[name]; 
>        // i don't want to send this from here. i want the admin to see 
> all messages from different users 
>        // and he should be able to reply whenever he wants to 
>       //to.emit('msg', { text: "what's up " + name }); 
>     }); 
>   }); 
> }); 
>

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to