IScope: A statefull object shared between a group of clients connected to the same context path. Scopes are arranged in hierarchical way, so its possible for a scope to have a parent and children scopes.If a client connects to a scope then they are also connected to its parent scope. The scope object is used to access resources, shared object, streams, etc. That is, scope are general option for grouping things in application. The following are all names for scopes: application, room, place, lobby.
ApplicationAdapter: The app* methods are called for the main application, the room* methods are called for
rooms (i.e. instances) of the application. (subsequentail call will only trigger connect, not join, so join is bigger)
Assuming you connect to rtmp://server/app/room1/room2
First connection:
1. app (-> appConnect)
2. room1 (-> roomConnect)
3. room2 (-> roomConnect)
After first connection:
1. app (-> appJoin)
2. room1 (-> roomJoin)
3. room2 (-> roomJoin)
matrix start/stop connect/disconnection join/leave
app ... ... ...
room ... ... ...
For start/connection/join, return true if success, false otherwise.
rejectClient methods can be called to reject a currently connecting client, different between start/connection/join return false?
IConnection: Each connection has an associated client and scope.
Current connection is retrieved through: 1. Red5.getConnectionLocal(); 2. when "public XXX xxx(IConnection conn, ...)" is called by client.
Client call server's methods: (methods inside application adapter is automatically callable from client?) Register an object (can be any type) as a handler using the following 2 ways:
1.<bean id="sample.service" class="com.fancycode.red5.HandlerSample" singleton="true" />
Note that "service" is a keyword, client codes only need to refer to "sample". This will apply to all scope.
2.Iscope(IServiceHandlerProvider).registerServiceHandler("sample", handler), note that this will override the spring config for chosen scope, and should consider putting it in either appStart/roomStart to choose correct scope.
Server call client's methods: if IConnection is IServiceCapableConnection, use the invoke method, pass a IPendingServiceCallback if you need a method call result.
ISharedObject:
Create/retrieve: use ApplicationAdapter.createSharedObject/getSharedObject. Create it in appStart/Connect or roomStart/Connect.
Data synchronization: use ISharedObject.setAttribute to update data, use ISharedObject.beginUpdate/endUpdate to issue a batch update, use ISharedObject.addSharedObjectListener(ISharedObjectListener) to get informed by update.
Method call: use ISharedObject.registerServiceHandler or <bean id="sampleSO.one.two.soservice" class="com.fancycode.red5.MySharedObjectHandler" /> ("soservice" is keyword, and the shared object will be created in all scope?) to register a service, use ISharedObject.sendMessage to invoke service.
Persistence:
IPersistable: Basically these objects have a type, a path, a name (all strings) and know how to serialize and deserialize themselves.
IPersistenceStore: Used to save and load IPersistable to somewhere. For FilePersistence implementation, a file is created in "webapps/<app>/persistence/<type>/<path>/<name>.red5", e.g. for a shared object "theSO" in the connection to "rtmp://server/myApp/room1" a file at
"webapps/myApp/persistence/SharedObject/room1/theSO.red5" would be created.
To make a object persitable, either put it in IScope through IAttributeStore's method, because IScope implements IPersistable, it will be load/save by server automatically, or find the global IPersistenceStore used by the server, using IScope.getStore(), to load/save object manually.
Scheduling: includes ISchedulingService and IScheduledJob, as ApplicationAdapter already implements ISchedulingService, all you have to do is just implement IScheduledJob, add it to ApplicationAdapter and store the job id somewhere (in a IScope maybe) so that you can manage it from ApplicationAdapter later.
Stream file name:
IStreamFilenameGenerator: implement this class to decide the file path to save in server, use <bean id="streamFilenameGenerator" class="..." /> (use IStreamFilenameGenerator.BEAN_NAME as bean id).
Flash client: the NetStream.play/publish method accept a file name, which will be used to resolve to actual path in server.
Compare ApplicationAdapter with Servlet?
ApplicationAdapter/IConnection/IXXXHandler design pattern?
分享到:
相关推荐
Sybex - RHCE Red Hat Certified Engineer Study Guide
IBM Redbook - Case Study: AIX and WebSphere in an Enterprise Infrastructure
RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302), Fifth Edition byMichael Jang McGraw-Hill/Osborne 2007 (896 pages) ISBN:9780072264548 With hundreds of practice questions and hands...
RedHat Linux RHCE RHCSA 7th Study Guide
Like many in the Linux community, you’ve probably heard of the Red Hat Certified Engineer (RHCE) program and the related RHCE exam, both of which were created by Red Hat, Inc. You may have heard that...
RHCE Red Hat Certified Engineer Linux Study Guide Exam RH302 4 ED 2004
McGraw.Hill.RHCE.Red.Hat.Certified.Engineer.Linux.Study.Guide.Exam.RH302.5th.Edition.Jun.2007.part2.rar
Diagnosis and troubleshooting <br>This redbook helps AIX 5L professionals seeking a comprehensive and task-oriented guide for developing the knowledge and skills required for the certification....
McGraw.Hill.RHCE.Red.Hat.Certified.Engineer.Linux.Study.Guide.Exam.RH302.fifth.Edition.Jun.2007.part1.rar
Red Hat Linux9普通版.pdf
This guide teaches you how and what to study in order to be best prepared for the Certified OpenStack Administrator exam. This fast-growing technology is creating a market that needs more qualified IT...
:grinning_face:该博客由本人自己总结,在复习过程中的一些知识点笔记,目前会在2021年持续更新 :red_heart: :red_heart:使用说明1. 请使用git 命令克隆到本地2. 由于本仓库为前端基础复习资料,因此全部为. md文件...
rhcsa/rhce7
已经编辑好的直接打印版PDF文件。 整篇文档由原PDF版本的889页缩减到463页,主体内容完整无删减。 单数页和双数页页边距进行了调整,提供正反面打印后的装订边距。 去掉了原版PDF中最后多余的索引部分。...
Background and aims: The spectral properties of enhanced green fluorescent protein ... This study aims to establish an imageable animal model of NPC using far-red fluorescent proteins. Methods: Eukary
A light purplish red sapphire is heat treated in an airtight crucible. The sample changes little in color after receiving heat treatment at 1100°C, but turns to light blue and blue after being ...
This study guide will help you to prepare for Linux/Unix Exam RH300, Red Hat Certified Engineer. Exam topics include Hardware and Installation, Configuration and Administration, Kernel Services, ...
:red_heart: Linux 概述 CS 101(美丽世界简介) :globe_showing_Asia-Australia: 最好的: 哈佛CS50(Advance&Hard ***): C(基金会) :thumbs_up: 基本(孟加拉): 最推荐: 个人推荐 大学参考 指针 C与项目:...
DO180-容器,Kubernetes和Red Hat OpenShift简介 EX280-OpenShift管理I EX220-混合云管理 进行中的主题 感兴趣的话题 EX288-OpenShift应用程序开发 EX318-虚拟化 EX342-诊断和故障排除 EX442-性能调优 EX210-...
<font color="red">permeal11*rhol/mul*A*B*-20)))^/-20)))^)*DuDx; s=0;复制代码f就是本人那个非常恶心的函数,对应着方程2-2来看。其中涉及3个m文件,permeav11.m 、permeal11.m和 t10585.m,待会一起给出。 要...