Intercept/store chat message on server (latest alpha)?

114 views
Skip to first unread message

Fabian Bernhard

unread,
Nov 15, 2013, 7:15:38 PM11/15/13
to eas...@googlegroups.com
Dear group,

I am using the latest alpha branch. Is there a way to intercept chat messages sent through the web socket on the server? I would like to store the chat history for a given room in a database. 

Thank you!

Fabian

Eric Davies

unread,
Nov 17, 2013, 12:09:12 AM11/17/13
to eas...@googlegroups.com
Hi Fabian,

I would the expect the answer is yes, but you may have to wait a week for an answer because Rod's the server man and he's getting ready to give some talks at the WebRTC expo in Santa Clara 19-2 (read, he's crazy busy trying to get ready [the curse of the being the most competent person in the room is that you do all the packing]) However, if you happen to be at the WebRTC expo, you can ask him in person.

Eric.

Rod Apeldoorn

unread,
Nov 18, 2013, 12:08:40 AM11/18/13
to eas...@googlegroups.com
My apologies for the late reply...

My biggest problem was I wasn't happy with the 0.10.2 method of calling the default listener, so in 0.10.3 I added a new emitDefault function to the events object. I also added some better documentation for events.


var easyrtcServer = easyrtc.listen(httpApp, socketServer);

// Our new custom listener
var onEasyrtcMsg = function(connectionObj, msg, socketCallback, next){
    // Return any connections not to IM demo to the default listener.
    if (connectionObj.getAppName() != "easyrtc.instantMessaging") {
        easyrtc.events.emitDefault("easyrtcMsg", connectionObj, msg, socketCallback, next);
        return;
    }
    
    console.log("Received a message which we can now log:", msg);

    // Reverting control back to default listener.
    easyrtc.events.emitDefault("easyrtcMsg", connectionObj, msg, socketCallback, next);
};

// Set our listener to take over for 'easyrtcMsg' events.
easyrtc.events.on("easyrtcMsg", onEasyrtcMsg);


- Rod Apeldoorn, Priologic Software

Fabian Bernhard

unread,
Nov 18, 2013, 7:37:40 AM11/18/13
to eas...@googlegroups.com
Great, thanks a lot!
Reply all
Reply to author
Forward
0 new messages