20090312 (Red5 Study 2)

Standalone server


Should be inside "red5-web.xml" in WEB-INF?


What's the usage of webAppRootKey?
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>/myapp</param-value>
</context-param>


Default scope: The default scope usually has the name web.scope, but the name can be chosen arbitrarily.
<bean id="web.scope" class="org.red5.server.WebScope" init-method="register">
 <property name="server" ref="red5.server" />
 <property name="parent" ref="global.scope" />
 <property name="context" ref="web.context" />
 <property name="handler" ref="web.handler" />
 <property name="contextPath" value="/myapp" />
 <property name="virtualHosts" value="localhost, 127.0.0.1" />
</bean>


Scope refer to context and handler (different from service)


Context: the context bean has the reserved name web.context and is used to map paths to scopes, lookup services and handlers. The default class for this is org.red5.server.Context.
<bean id="web.context" class="org.red5.server.Context" autowire="byType"/>


Handler: every context needs a handler that implements the methods (IScopeHandler) called when a client connects to the scope, leaves it and that contains additional methods that can be called by the client.
<bean id="web.handler" class="org.red5.server.adapter.ApplicationAdapter" singleton="true" />


Integrated in tomcat


"xxx-context.xml" in classpath will be loaded automatically?

What's the usage of globalScope, contextConfigLocation, parentContextKey, log4jConfigLocation?
<context-param>
 <param-name>globalScope</param-name>
 <param-value>default</param-value>
</context-param>
<context-param>
 <param-name>contextConfigLocation</param-name>
 <param-value>WEB-INF/classes/*-web.xml</param-value>
</context-param>
<context-param>
 <param-name>parentContextKey</param-name>
 <param-value>default.context</param-value>
</context-param>
<context-param>
 <param-name>log4jConfigLocation</param-name>
 <param-value>/WEB-INF/log4j.properties</param-value>
</context-param>

References the context listener servlet of the application, this technically takes the place of the Standalone.class in a standard Red5 server
<listener>
<!-- Impersonates a org.springframework.web.context.ContextLoaderListener -->
<listener-class>org.red5.server.MainServlet</listener-class>
</listener>


Every application can only have one context and they should follow this naming convention '<application name>.context' so that they will not conflict with one another?


Multiple language support is achieved by passing a script file name and a list of implemented interface to script factory, so that is can dynamically create a java class which implements IScopeHandler (or maybe some service interface).
<bean id="web.handler" class="org.red5.server.script.groovy.GroovyScriptFactory">
 <constructor-arg index="0" value="classpath:applications/main.groovy"/>
 <constructor-arg index="1">
  <list>
   <value>org.red5.server.api.IScopeHandler</value>
   <value>org.red5.server.adapter.IApplication</value>
  </list>
 </constructor-arg>
</bean>


RTMPT basically is a HTTP wrapper around the RTMP protocol that is sent using POST requests from the client to the server. Because of the non-persistent nature of HTTP connections, RTMPT requires the clients to poll for updates periodically in order to get notified about events that are generated by the server or other clients.
URL should be http://server/<comand>/[<client>/]<index>
Commands: Initial connect (command "open"), Client updates (command "send"), Polling requests (command "idle"), Disconnect of a session (command "close")
Client: specifies the id of the client that performs the requests (only sent for established sessions)
Index: is a consecutive number that seems to be used to detect missing packages
Polling interval: first byte of the response data controls the polling interval of the client, the server always starts with a value of 0x01 after data was returned and increases it after 10 emtpy replies. The maximum delay is 0x21 which causes a delay of approximately 0.5 seconds between two requests.


WebScope scope = (WebScope)appFactory.getBean("web.scope");
scope.setServer(server); // when the server created?
scope.setParent(global); // what about global scope?
scope.register();
scope.start(); // starts a scope? but isn't is starts automatically when a request comes?


"red5.server" and "global.scope" bean?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值