Integrating with PubNub

Posted by oedev on 25-Jun-2014 04:38

Hi,

I'm looking at integrating our Openedge 10.2B application with PubNub (www.pubnub.com). PubNub provides a number of SDK's (http://www.pubnub.com/developers/), unsurprisingly there is nothing for Openedge.

I'm trying to convert a C# example to Openedge, but cannot work out how to implement a call to the following method;

METHOD PUBLIC FINAL logical Publish (channel AS character, message AS CLASS System.Object, userCallback AS CLASS "System.Action<System.Object>", errorCallback AS CLASS "System.Action<PubNubMessaging.Core.PubnubClientError>")


Fine with channel and message. However, the how do I implement the 2 callback methods ? Tried putting method names in their place but that does not work.

Thanks!

All Replies

Posted by oedev on 25-Jun-2014 04:40

P.S. The example I'm trying to convert comes from woutercx.com/.../simple-pubnub-csharp-example

Posted by Mike Fechner on 25-Jun-2014 04:42

You can’t pass ABL function/method references to .NET.
 
All you can do is build your own .NET library, which translates the synchronous callbacks into .NET events which you can handle from the ABL side.
 
When the thing is async, you will need to perform the thread synchronization on the .NET side using the InvokeRequired/Invoke mechanics.

Posted by oedev on 25-Jun-2014 04:49

Thanks for the quick response.

I understand the bit about creating my own .NET assembly, but not sure about async ? As the C# SDK is provided in source format (github.com/.../PubNub-Messaging), it might be easier/better to change that to expose the publish/subscribe as events rather than callback methods. Not an expert in this area, so any advise appreciated.

Posted by Mike Fechner on 25-Jun-2014 04:55

If it’s async or not, is something you find out best from their docs.

I personally have the tendency to build a wrapper around 3rd party code – even when available in source code. That way I don’t have to change that 3rd party code and can more easily upgrade the base code without having to reapply my modifications to it.

 

Posted by oedev on 25-Jun-2014 05:01

Good point. Will have a play :-)

This thread is closed