Permalink
Browse files

Add realtime-connection-management sample

  • Loading branch information...
1 parent a176ce4 commit 6e700daa40dc2fad0cb58ef1b45b494fc2c0c197 @capflam capflam committed Feb 24, 2014
@@ -0,0 +1 @@
+SDK/*
@@ -0,0 +1,33 @@
+Realtime-connection-management sample
+=====================================
+
+To use this sample you have to:
+
+* Create an account on the [Scoreflex platform](http://developer.scoreflex.com/
+ "Scoreflex developer site") (if you don't have one already).
+* Create a game -or modify an existing one- (check the **Web** option in the
+ list of available platforms).
+* Checkout this sample and copy the [Scoreflex Javascript
+ SDK](https://github.com/scoreflex/scoreflex-javascript-sdk "Scoreflex
+ Javascript SDK on GitHub") to the `SDK/` folder (sample tested with the
+ realtime branch)
+* Edit the *game.js* file and update the `clientId` and `clientSecret` variables
+ with your game's identifiers.
+
+------
+
+The realtime-connection-management sample focuses on the following Scoreflex SDK features:
+
+* Manage lifecycle of the realtime session:
+ - Manage Scoreflex SDK initialization/deinitialization
+ - Handle player login/logout events
+ - Manage realtime session initialization/deinitialization
+* Manage the realtime connection
+
+Typical use-cases covered by this sample:
+
+* Use Restart/Stop buttons to test initialization/deinitialization of the SDK
+ and the realtime session.
+* Use login/logout from the user's profile WebView to test the player changes.
+* Use Connect/Disconnect buttons to open/close connection on the realtime
+ service.
@@ -0,0 +1,65 @@
+HTML,
+BODY {
+ margin:0;
+ padding:0;
+}
+BODY {
+ font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+}
+
+#infoDiv {
+ margin: 1em;
+ padding-left: 0.5em;
+ border: 1px solid #000;
+ width: 750px;
+ height: 600px;
+ overflow-y: scroll;
+ line-height: 80%;
+}
+#infoDiv .infoDate {
+ display: inline;
+ font-size: 13px;
+ margin-right: 5px;
+}
+#infoDiv .infoTxt {
+ display: inline;
+}
+#infoDiv .infoTxt PRE {
+ display: inline;
+ margin: 0;
+}
+
+#restartDiv {
+ margin: 1em;
+ width: 750px;
+ text-align: center;
+}
+
+BUTTON {
+ padding:0.3em 1em;
+ font-size:1em;
+ font-weight:bold;
+ border-radius:5px;
+ box-shadow:0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
+ margin:0.2em;
+ cursor:pointer;
+ border:1px solid transparent;
+}
+BUTTON.enabled {
+ background-color: #6E7273;
+ border-color: rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.25);
+ color: #FFFFFF;
+ text-shadow: 0 -1px 0 #505455;
+}
+
+BUTTON.disabled {
+ border-color: rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.25);
+ color: #FFFFFF;
+}
+
+.scoreflexWebClient_full {
+ height: 800px;
+ position: absolute;
+ right: 0;
+ top: 0;
+ width: 480px;
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Realtime connection management sample</title>
+ <link href="./game.css" type="text/css" rel="stylesheet">
+ </head>
+ <body>
+ <div id="restartDiv">
+ <button id="restartButton" class="disabled">Restart</button>
+ <button id="stopButton" class="disabled">Stop</button>
+ <button id="connectionButton" class="disabled">Connect</button>
+ <button id="showProfileButton" class="disabled">Player's profile</button>
+ <button id="clearLogButton" class="enabled">Clear log</button>
+ </div>
+ <div id="infoDiv"></div>
+ <script type="text/javascript" src="./SDK/libs/CryptoJS/rollups/hmac-sha1.js"></script>
+ <script type="text/javascript" src="./SDK/libs/CryptoJS/components/enc-base64-min.js"></script>
+ <script type="text/javascript" src="./SDK/libs/Json/json2.js"></script>
+ <script type="text/javascript" src="./SDK/libs/ProtoBuf/Long.js"></script>
+ <script type="text/javascript" src="./SDK/libs/ProtoBuf/ByteBuffer.js"></script>
+ <script type="text/javascript" src="./SDK/libs/ProtoBuf/ProtoBuf.js"></script>
+ <script type="text/javascript" src="./SDK/scoreflex.js"></script>
+ <script type="text/javascript" src="./SDK/scoreflexRealtime.js"></script>
+ <script type="text/javascript" src="./game.js"></script>
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 6e700da

Please sign in to comment.