How reference the existing object to do rpc/socket .destroy?

132 views
Skip to first unread message

swe...@gmail.com

unread,
May 29, 2014, 5:05:19 PM5/29/14
to eas...@googlegroups.com
I've got this working, but how do I reference the existing object so I can destroy it?

function loadExternalSite(e) {

            var socket = new easyXDM.Socket({

remote: e,

container: CBkExternalSite.GetMainElement().id,

props: {

style: {

width: "100%",

height: "100%"

}

},

onMessage: function (message, origin) {

if (message == "READY") {

LoadingPanel.Hide();

} else {

alert("Received '" + message + "' from '" + origin + "'");


}

}

});

}

swe...@gmail.com

unread,
May 30, 2014, 4:44:31 PM5/30/14
to eas...@googlegroups.com
Listen.... I'm willing to pay someone with experience with this library to help me out! ANYONE out there????

On Thursday, May 29, 2014 4:05:19 PM UTC-5, swe...@gmail.com wrote

Øyvind Sean Kinsey

unread,
May 30, 2014, 6:07:00 PM5/30/14
to easyxdm
I'm not sure I understand your question - you have it right there `var socket = ....` - you destroy this by calling `socket.destroy();`.
If you need to do this from within onMessage, then that function closes over the `socket` variable, so you have access to it.



Øyvind Sean Kinsey
San Francisco, CA


On Fri, May 30, 2014 at 1:44 PM, <swe...@gmail.com> wrote:
Listen.... I'm willing to pay someone with experience with this library to help me out! ANYONE out there????

On Thursday, May 29, 2014 4:05:19 PM UTC-5, swe...@gmail.com wrote

--
You received this message because you are subscribed to the Google Groups "easyxdm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to easyxdm+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

swe...@gmail.com

unread,
Jun 2, 2014, 3:08:51 PM6/2/14
to eas...@googlegroups.com
WOW!!!! You do live... I've been trying to reach you via emails for a couple weeks. I was able to get it work today... I had forgotten to create a global variable to hold the instance so I could call the .destroy method.

I do how ever have some further questions about the library.
1. knowing that messages are in open free text. How do/would I secure the socket communication? I seen were you've talked about json in other websites/easyXDM.net, but I'm a rather new jscript developer and new to using it. How would you secure sockets?  Say I want to pass username and password from parent to child so I could auto-login the users within the frame?

2. how do capture any errors that are generated?

3. I've tried using onReady when creating the instance on the website/parent, but its not working... am I doing it wrong?
    var currentSocket;
        function SetSplitterSize() {
            ContentSplitInCB.SetHeight(CBkExternalSite.GetHeight());
        }
        function loadExternalSite(e) {
                currentSocket = new easyXDM.Socket({

                remote: e,
                container: CBkExternalSite.GetMainElement().id,
                props: {
                    style: {
                        width: "100%",
                        height: "100%"
                    }
                },
                onMessage: function (message, origin) {
                    if (origin = '*.agfc.com') {

                        if (message == "READY") {
                            LoadingPanel.Hide();
                        } else {
                            alert("Received '" + message + "' from '" + origin + "'");
                            SessionTimeout.sendKeepAlive();
                        }
                    }
                },
  onReady: function() {
   alert('Ready');
  }
            });

Øyvind Sean Kinsey

unread,
Jun 2, 2014, 3:23:26 PM6/2/14
to easyxdm
I try to give whatever community we have here a chance to answer first :)

1) Secure from whom? The messages are only available to code running in the sender and recipient windows, but within those, there exists no way to isolate access further (this goes for all JavaScript programs).
2) Generated through what action? easyXDM doesn't swallow any exceptions (but does has a ton of assertions that throw), so your best bet is try/catch with a global error handler (due to the asynchronous nature)
3) Isn't it whenReady and not onReady?


Øyvind Sean Kinsey
San Francisco, CA


swe...@gmail.com

unread,
Jun 2, 2014, 3:52:55 PM6/2/14
to eas...@googlegroups.com
1. Maybe I'm over thinking this too much, but secure from unwanted eyes of hackers to see what text is getting transmitted through anyone using packet sniffing.
2.Well per #3 shouldn't something comeback from the library throw and error that onReady didn't work? like an "onError"?
3. I've tried both onReady and whenReady and neither worked. I'm using the socket method.... should I be using a different method like rpc?

Øyvind Sean Kinsey

unread,
Jun 2, 2014, 4:27:17 PM6/2/14
to easyxdm
1) Then that is outside of the scope of easyXDM - easyXDM is a pure in-memory transport - SSL is what protects you from snooping on the wire
2) The library throws, it's up to you to catch this (or put up a PR adding an onError callback)
3) OK, so it was actually onReady (https://github.com/oyvindkinsey/easyXDM/blob/master/src/Socket.js#L93) - if this is not fired, look for errors


Øyvind Sean Kinsey
San Francisco, CA


swe...@gmail.com

unread,
Jun 4, 2014, 11:46:45 AM6/4/14
to eas...@googlegroups.com
Øyvind,

Seeing that your very busy with your new job at facebook. Is there anyone that you would recommend that knows this easyXDM very well and would sell some consulting time to help me with a few things?

Thanks,
Scott
Reply all
Reply to author
Forward
0 new messages