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案例研究:AIX与WebSphere在企业基础设施中的集成 IBM Redbook的这份案例研究详尽地探讨了如何在企业级架构中整合IBM的AIX操作系统和WebSphere应用服务器,尤其聚焦于与微软的Active Directory进行...
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...
"RHCSA/RHCE Red Hat Linux Certification Study Guide, Seventh Edition"知识点总结 本书是Red Hat Linux认证考试的学习指导手册,第七版,涵盖了RHCSA和RHCE考试的所有内容。下面是本书的知识点总结: 一、Red ...
在本压缩包“Matlab series -- Matlab study demos. 数字图像处理课程学习的代码存档。”中,包含的是一个用于数字图像处理课程学习的Matlab代码集合。Matlab是一款强大的数学计算软件,广泛应用于科学研究、工程...
Red Hat Linux9普通版.pdf
标题 "percentage-of-an-student-based-on-the-no.-of-study-hours" 暗示我们要讨论的是如何基于学生的学习小时数来计算他们的学习投入比例。在IT领域,这可能涉及到数据分析、数据处理和可视化,通常使用编程语言如...
RHCE Red Hat Certified Engineer Linux Study Guide Exam RH302 4 ED 2004
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...
McGraw.Hill.RHCE.Red.Hat.Certified.Engineer.Linux.Study.Guide.Exam.RH302.5th.Edition.Jun.2007.part2.rar
McGraw.Hill.RHCE.Red.Hat.Certified.Engineer.Linux.Study.Guide.Exam.RH302.fifth.Edition.Jun.2007.part1.rar
在“WORLD-STUDY-main”这个文件夹中,很可能包含了项目的基础代码结构,包括HTML文件、CSS文件和可能的JavaScript文件。通过这些文件,我们可以进一步细化和扩展网站的设计,添加动态效果,实现用户交互,从而构建...
- **链式操作**: jQuery的对象返回总是自身,这使得多个方法调用可以连在一起,如`$("#myDiv").css("color", "red").fadeIn(500);`。 - **动画效果**: jQuery提供了丰富的动画效果,如`fadeIn()`, `fadeOut()`, `...
:grinning_face:该博客由本人自己总结,在复习过程中的一些知识点笔记,目前会在2021年持续更新 :red_heart: :red_heart:使用说明1. 请使用git 命令克隆到本地2. 由于本仓库为前端基础复习资料,因此全部为. md文件...
rhcsa/rhce7
- (1) This is a red sun. (形容词作定语) - (2) The man in blue is my brother. (介词短语作定语) 6. **状语**: 状语用来修饰动词、形容词、副词、介词短语或整个句子,通常由副词担当。它可以表明时间、地点...
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 ...
已经编辑好的直接打印版PDF文件。 整篇文档由原PDF版本的889页缩减到463页,主体内容完整无删减。 单数页和双数页页边距进行了调整,提供正反面打印后的装订边距。 去掉了原版PDF中最后多余的索引部分。...
标题中的"CentOS-6.1-x86_64-bin-DVD1镜像.part5.rar"揭示了我们要讨论的是一个Linux发行版CentOS的6.1版本,针对64位(x86_64)系统的安装光盘镜像。这个镜像是分成了五部分的RAR压缩文件,其中“part5”是我们当前...