THis plugin allows you to exchange messages between two iframes created within C2
I'm using the postMessage
HTML5 API, allowing me two exchange messages between allowed iframes.
To illustrate the use of that plugin, imagine you create a game in C2 that must support two players, on the same screen.
To do that, you can create 3 C2 projects : one with just two iframes on a layout, each one linking to the URL of anoter exported C2 project.
With tat, each player can send a message to the other playe (playing on the same machine/tablet/phone <= although it's going to be a bit tiny on a phone
Since those message are text, you can decide to send the position of the player pieces (as text, and you parse it on the other side), or the base64 string of an image, or anything else.
You can imagine a battleship game where you send the position of the hit as "(x,y)" (text string) to the other side, for example !
To enforce security, you MUST specify the URL of the domain you want to accept message from, in the properties of the Plugin (or else somebody can hijack your app).
The demo : https://dl.dropbox.com/u/1412774/iFramePostMessageDemo/index.html
The plugin : https://dl.dropbox.com/u/1412774/iFramePostMessageDemo/pode_postMessage.1.0.zip
The .capx ("Main app"
) : https://dl.dropbox.com/u/1412774/iFramePostMessageDemo/iFramePostMessageDemo.capx
The .capx ("Player 1"
) : https://dl.dropbox.com/u/1412774/iFramePostMessageDemo/iFramePostMessageDemoPlayer1.capx
The .capx ("Player 2"
) : https://dl.dropbox.com/u/1412774/iFramePostMessageDemo/iFramePostMessageDemoPlayer2.capx