forked from h3xstream/rtmfp-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
115 lines (97 loc) · 4.27 KB
/
index.html
File metadata and controls
115 lines (97 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Rtmfp API</title>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script>
<link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css"/>
<link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeEclipse.css"/>
<script type="text/javascript">SyntaxHighlighter.all();</script>
<link rel='stylesheet' type='text/css' href='gh-pages/styles.css'/>
</head>
<body>
<div id="main">
<div id="header">
<h1>Rtmfp API</h1> <span id="subtitle">P2P for all..</span>
</div>
<div id="content">
<a name="what"><h2>What is it?</h2></a>
<p>This project expose Rtmfp protocol (provided by Flash version 10) to javascript application throught a hidden flash applet.
The protocol allow multiple clients to communicate <b>directly</b>. See the <a href="#refs">references</a> for more details about the protocol.</p>
<p>Possible uses include:</p>
<ul>
<li>Game</li>
<li>Real-time communication</li>
<li>High bandwith communication</li>
<li>Chat application</li>
</ul>
<a name="use"><h2>How to use it</h2></a>
<p>
Initialisation:</p>
<pre class="brush: js;">
var config = {
DEBUG:false, //Internal debug of the Flash applet will be output to console.info
rtmfpUrl:'rtmfp://p2p.rtmfp.net/API_KEY'}; //Rtmfp server
//Functions to handle the various events
var callbacks = {
onPeerIdRecvCall: onPeerIdRecv,
onMessageRecvCall: onMessageRecv,
onPeerConnectCall: onPeerConnect,
onPeerDisconnectCall: onPeerDisonnect};
rtmfp = new Rtmfp("../../bin/rtmfp.swf",config,callbacks);
</pre>
<p>Define the different callbacks:</p>
<pre class="brush: js;">
onPeerIdRecv = function(peerId) {
...
}
onMessageRecv = function(peerId,cmd,object) {
...
}
onPeerConnect = function(peerId) {
...
return true; //If the incoming connection is accept
}
onPeerDisconnect = function(peerId) {
...
}
</pre>
<p>Use the main instance (Rtmfp object) to connect to peer and send message.
The main principe of Rtmfp communication is that you can only send message
to those who are <b>connected to you</b>.</p>
<pre class="brush: js;">
//Once connected messages can be _received_ from this peer
rtmfp.connectToPeer("6487b[...]");
//Publish message to all connected peers
//The data passed can be any serializable js object
rtmfp.send("NICKNAME","bob");
rtmfp.send("LIST_ITEMS",["1","2","3","4"]);
</pre>
<a name="demos"><h2>Demos</h2></a>
<ul>
<li><a href="demos/chat/">Chat</a></li>
</ul>
<a name="refs"><h2>References</h2></a>
<b>Rtmfp documentation</b><br/>
<ul>
<li><a href="http://labs.adobe.com/technologies/cirrus/">Adobe website (include a link to register for api key)</a></li>
<li><a href="http://tv.adobe.com/watch/max-2008-develop/future-of-communication-with-rtmfp-by-matthew-kaufman/">Future of communication with RTMFP by Matthew Kaufman</a></li>
<li><a href="http://tv.adobe.com/watch/max-2009-develop/p2p-on-the-flash-platform-with-rtmfp/">P2P on the Flash Platform with RTMFP</a></li>
</ul>
<b>If you want to modify the flash applet...</b><br/>
<ul>
<li><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html">NetStream reference documentation</a></li>
</ul>
<b>Javascript libraries use</b><br/>
<ul>
<li><a href="http://jquery.com/">JQuery</a></li>
<li><a href="http://code.google.com/p/jquery-json/">JQuery-json</a></li>
<li><a href="http://code.google.com/p/swfobject/">Swfobject</a></li>
</ul>
</div>
<div id="footer">
Project started by <a href="https://github.com/h3xstream">h3xStream</a> and <a href="https://github.com/HoLyVieR">HoLyVieR</a>
</div>
</div>