• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PluginRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.red5.server.plugin.PluginRegistry的典型用法代码示例。如果您正苦于以下问题:Java PluginRegistry类的具体用法?Java PluginRegistry怎么用?Java PluginRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PluginRegistry类属于org.red5.server.plugin包,在下文中一共展示了PluginRegistry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onWSMessage

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
@Override
public void onWSMessage(WSMessage message) {
    // assume we have text
    String msg = new String(message.getPayload().array());
    log.info("onWSMessage: {}", msg);
    // get the path 
    String path = message.getPath();
    // just echo back the message
    WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager(path);
    if (manager != null) {
        // get the ws scope
        WebSocketScope wsScope = manager.getScope(path);
        Set<WebSocketConnection> conns = wsScope.getConns();
        for (WebSocketConnection conn : conns) {
            log.debug("Echoing to {}", conn);
            try {
                conn.send(msg);
            } catch (UnsupportedEncodingException e) {
                log.warn("Encoding issue with the message data: {}", message, e);
            }
        }
    } else {
        log.info("No manager found for path: {}", path);
    }
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:26,代码来源:DefaultWebSocketDataListener.java


示例2: sessionClosed

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void sessionClosed(IoSession session) throws Exception {
    log.trace("Session closed");
    // remove connection from scope
    WebSocketConnection conn = (WebSocketConnection) session.removeAttribute(Constants.CONNECTION);
    if (conn != null) {
        // remove from the manager
        WebSocketPlugin plugin = (WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin");
        if (plugin != null) {
            String path = conn.getPath();
            if (path != null) {
                WebSocketScopeManager manager = (WebSocketScopeManager) session.removeAttribute(Constants.MANAGER);
                if (manager == null) {
                    manager = plugin.getManager(path);
                }
                if (manager != null) {
                    manager.removeConnection(conn);
                } else {
                    log.debug("WebSocket manager was not found");
                }
            } else {
                log.debug("WebSocket connection path was null");
            }
        } else {
            log.debug("WebSocket plugin was not found");
        }
    } else {
        log.debug("WebSocket connection was null");
    }
    super.sessionClosed(session);
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:35,代码来源:WebSocketHandler.java


示例3: receive

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
/**
 * Receive data from a client.
 * 
 * @param message
 */
public void receive(WSMessage message) {
    log.trace("receive message");
    if (isConnected()) {
        WebSocketScopeManager manager = (WebSocketScopeManager) session.getAttribute(Constants.MANAGER);
        if (manager == null) {
            WebSocketPlugin plugin = (WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin");
            manager = plugin.getManager(path);
        }
        WebSocketScope scope = manager.getScope(path);
        scope.onMessage(message);
    } else {
        log.warn("Not connected");
    }
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:20,代码来源:WebSocketConnection.java


示例4: register

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
/**
 * Registers with the WebSocketScopeManager.
 */
public void register() {
    log.info("Application scope: {}", scope);
    // set the logger to the app scope
    //log = Red5LoggerFactory.getLogger(WebSocketScope.class, scope.getName());
    WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager(scope);
    manager.setApplication(scope);
    log.info("WebSocket app added: {}", scope.getName());
    manager.addWebSocketScope(this);
    log.info("WebSocket scope added");
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:14,代码来源:WebSocketScope.java


示例5: testUriWithParams

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
@Test
public void testUriWithParams() throws Throwable {
    log.info("\ntestUriWithParams enter");
    // create the server instance
    Thread server = new Thread() {
        @Override
        public void run() {
            log.debug("Server thread run");
            try {
                WSServer.main(null);
            } catch (IOException e) {
                log.error("Error in server thread", e);
            }
            log.debug("Server thread exit");
        }
    };
    server.setDaemon(true);
    server.start();
    // add plugin to the registry
    WebSocketPlugin plugin = new WebSocketPlugin();
    PluginRegistry.register(plugin);
    // start plugin
    plugin.doStart();
    // create a scope for the manager
    IScope appScope = new GlobalScope();
    // create an app
    MultiThreadedApplicationAdapter app = new MultiThreadedApplicationAdapter();
    app.setScope(appScope);
    // add the app
    plugin.setApplication(app);
    // get the manager
    WebSocketScopeManager manager = plugin.getManager(appScope);
    manager.setApplication(appScope);
    // wait for server
    while (!WSServer.isListening()) {
        Thread.sleep(10L);
    }
    // create the client
    final TyrusWSClient client = new TyrusWSClient();
    //final TyrusWSClient client = new TyrusWSClient(8192 * 10);
    Thread t = new Thread(new Runnable() {
        public void run() {
            client.start();
        }
    }, "tyrus");
    t.start();
    t.join(5000);
    // send a message
    //client.sendMessage("This is a test");
    // terminate client
    client.terminate();
    // stop server
    server.interrupt();
    WSServer.stop();
    // stop plugin
    PluginRegistry.shutdown();
    log.info("testUriWithParams exit");
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:59,代码来源:WebSocketServerTest.java


示例6: appStart

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
@Override
public boolean appStart(IScope scope) {
    WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager();
    manager.addApplication(scope);
    return super.appStart(scope);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:7,代码来源:Application.java


示例7: appStop

import org.red5.server.plugin.PluginRegistry; //导入依赖的package包/类
@Override
public void appStop(IScope scope) {
    WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager();
    manager.removeApplication(scope);
    super.appStop(scope);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:7,代码来源:Application.java



注:本文中的org.red5.server.plugin.PluginRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProtobufDatumFactory类代码示例发布时间:2022-05-15
下一篇:
Java Name类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap