centrifuge

Migrated to Go language, see https://github.com/centrifugal/centrifugo

  • 所有者: FZambia/centrifuge
  • 平台:
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

CENTRIFUGE

WARNING!!! Centrifuge server migrated to Go language - it's now called Centrifugo and lives in another repo. This repo is for history only!

It's not compatible with entire Centrifugal stack so you have to use certain versions of libraries.

Here is a list of libraries versions compatible with Centrifuge:

Please, see new documentation for the entire Centrifugal stack.

Overview

In a few words: clients (users of your web application/site) connect to Centrifuge from browser,
after connecting clients subscribe on channels. Every message which was published into that
channel will be delivered to all clients which are currently subscribed on that channel.

To connect to Centrifuge from browser pure Websockets
or SockJS library can be used. So it works in both
modern and old browsers (IE 7 supported). Centrifuge has javascript client with simple API.

Backend is built on top of Tornado - fast and mature
asynchronous web server which can handle thousands of simultaneous connections.

Centrifuge scales using Redis PUB/SUB capabilities.
Single full-featured instance of Centrifuge run by default without extra dependency
on Redis.

There are tons of examples in internet about how to add real-time events on your site. But very few
of them provide complete, scalable, full-featured, ready to deploy solution. Centrifuge aims to be
such a solution with simplicity in mind.

Main features

  • Asynchronous backend on top of Tornado
  • SockJS and pure Websockets connection endpoints
  • Simple javascript client
  • Presence information, message history, join/leave events for channels
  • Admin web interface
  • Flexible channel settings via namespaces
  • Language agnostic - you can go with Centrifuge even if your site built in Perl, PHP, Ruby etc.
  • Easily integrates with existing web site.

To get more information:

Various packages and tools related to Centrifuge located in Centrifugal
organization here on Github.

scheme

Similar projects / alternatives:

Basic usage from browser

var centrifuge = new Centrifuge({
    url: 'http://localhost:8000/connection',  // Centrifuge SockJS connection endpoint
    project: 'PROJECT_ID', // project ID from Centrifuge admin interface
    user: 'USER_ID', // your application user ID (can be empty for anonymous access)
    timestamp: '1395086390', // current UNIX timestamp (number of seconds as string)
    token: 'TOKEN', // HMAC token based on project's secret key, project ID, user ID and timestamp
});

centrifuge.on('connect', function() {

    console.log('connected');

    var subscription = centrifuge.subscribe('django', function(message) {
        // message from channel received
        console.log(message);
    });

    subscription.on('ready', function(){
        subscription.presence(function(message) {
            // information about who connected to channel at moment received
        });
        subscription.history(function(message) {
            // information about last messages sent into channel received
        });
        subscription.on('join', function(message) {
            // someone connected to channel
        });
        subscription.on('leave', function(message) {
            // someone disconnected from channel
        });
    });

});

centrifuge.on('disconnect', function(){
    console.log('disconnected');
});

centrifuge.connect();

For more information about javascript client API see documentation chapter

Tests

IMPORTANT! At moment tests require Redis running and clear database on every running. Be aware of this!

make test

LICENSE

MIT

Requirements Status
Build Status

主要指标

概览
名称与所有者FZambia/centrifuge
主编程语言Python
编程语言Makefile (语言数: 5)
平台
许可证Other
所有者活动
创建于2013-03-03 11:43:39
推送于2016-12-09 09:43:16
最后一次提交2016-12-09 12:43:16
发布数33
最新版本名称v0.8.4 (发布于 2015-10-24 10:26:05)
第一版名称v0.0.1 (发布于 2013-07-14 16:53:30)
用户参与
星数677
关注者数35
派生数38
提交数1k
已启用问题?
问题数0
打开的问题数0
拉请求数32
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?