0

I am working on a trading site which allows copy trading feature (that is, a trader copying me will get a trade copied into his account when I do a trade). Now when I do a trade, the trader who is copying me needs to get a realtime notification about that trade.

For example, a notification like this:

Image of a real-time HTML notification

We have access to pubnub and we would like to achieve this using pubnub. Our site is build on WordPress. How to integrate this notification feature using PHP and pubnub in our site?

halfer
  • 19,824
  • 17
  • 99
  • 186
karthi
  • 889
  • 12
  • 24

1 Answers1

1

You can either use our JS SDK that would trigger off the "trade committed" event (such as on mouse up of the trade button), or you could implement it as a blocking PHP call with the PHP SDK.

JS logic would potentially be more insecure, since anyone could perform research on what you are doing, and potentially replay and/or create imposter calls if you didn't protect the code correctly.

PHP would be the most secure way to address this, as all logic could be performed server-side, hidden from access to the end user.

PubNub for PHP

https://github.com/pubnub/php

PubNub for JS

http://www.pubnub.com/docs/javascript/javascript-sdk.html

Geremy
  • 2,415
  • 1
  • 23
  • 27
  • Hi Geremy, i tried the pubnub php SDK. When the trade is being done, am able to publish like this: $info = $pubnub->publish('channel','message');. I checked this using the developer console in pubnub and the message is published successfully. However, how i can subscribe this to copiers so that they get realtime notification if they are online. – karthi Mar 17 '15 at 06:14
  • 1
    Hi @karthi please shoot us an email to support@pubnub.com and we'll help you out... – Geremy Mar 17 '15 at 18:27