smartfoxserver2X平台架构
In this document we take a bird’s eye view at the SmartFoxServer 2X platform and briefly discuss each of the components in the stack. Starting at the core of the server we find the network engine (codenameBitSwarm) which is the third incarnation of the original socket engine built for SmartFoxServer 1.x. This layer provides unique features to SFS2X that are typically not found in other competitor’s solutions (we discuss all the technical details in a separate comprehensive white paper).
本篇文章将俯瞰smartfoxserver平台,并简单的介绍下这个架构的组成。从服务核心开始,我们发现网络通讯引擎(代号 BitSwarm)照SmartFoxServer1.x相比瘦身了三分之一。这是SFS2X独一无二的特性,没有其他框架拥有这个特性。(我们在纸上对每个部分都有详细的论述)。
In essence BitSwarm provides TCP/UDP connectivity, Session management, network security tools, the HRC (High-Resilient-Connections) system, clustering services, monitoring and more, using an highly scalable non-blocking design.
BitSwarm作为核心,提供了TCP和UDP连接,session管理,网络安全工具,HRC系统(高弹性连接),集群服务,监控等等,高伸缩的设计。
核心服务和管理
The lower layer of SmartFoxServer 2X provides a number of essential services and managers such as configuration services, logging, security, task scheduling, zone/room/user management, buddy lists, banned user management, remote administration, JMX, email services, http services, database integration and lots more.
SmartFoxServer 2X之前的版本提供了大量的基础服务和管理,比如与配置服务,日志,安全,任务调度,区、房间、用户管理,好友列表,禁止用户管理,远程管理,JMX,email服务,http服务,数据库整合等等。
All these services coalesce in a well organized set of Server API that provide developers a host of high level functionalities acting as the building blocks of their applications.
所有这些服务都ServerAPI中,结构分明,并为开发者提供了高级别的函数来构建自己的应用。
服务端API和扩展
Extensions are the mechanism by which developers can plug their own application logic in the system and leverage the Server API. In a similar way to a servlet container, the SFS2X framework provides an efficient way to handle custom client requests and server events. Rapid development is guaranteed by a rational workflow that provides hot-redeploy, automatic dependency discovery and a well-thought class loading mechanism.
扩展的原理就是开发插入程序的逻辑里的代码,对ServerAPI的行为产生影响。跟Servlet容器类似的,SFS2X框架提供了一个高效的方式来处理自定义的客户端请求和服务是服务器事件,提供热部署的工作流程和自动扫描类进行加载来保证程序的快速开发。
客户端API
The topmost element in the stack is the public API, which is exposed directly to the clients. Any application speaking the SFS2X protocol can access this API and interact with the server very easily and securely.
上图栈中顶端的public api是直接暴露给客户端的。任何使用SFS2X协议的应用程序都可以通过这个API跟服务端非常简单安全的通讯。
The client libraries also provide a consistent framework across all supported platforms, making it very easy to create multiple clients in Flash, Unity, iPhone and iPad, Android devices, etc. The following table shows all the supported platforms and languages.
客户端的函数库提供了所有支持平台的统一接口,创建许多的客户端如Flash, Unity, iPhone and iPad, Android devices等是很容易的。下面的表格展示了所有支持的平台和语言。
API language Platform |
ActionScript 3 | C# | Java | Objective C | JavaScript | C++ | |
Flash Web player Standalone |
|||||||
Unity Web player Standalone |
|||||||
iOS |
|||||||
Android | |||||||
HTML5 | |||||||
Java2 SE | |||||||
Mac OSX |
|||||||
Windows 8 | |||||||
Windows Phone 8 | |||||||
.Net / Mono | |||||||
Others (*) |
= native | = Unity publishing | = Adobe Air publishing
使用本地方法|使用Unity的方法 |使用flash的方法
(*) APIs behavior with other platforms (Blackberry, PS3, XBox, Wii, etc) not tested directly.
API对其它平台的如Blackberry, PS3, XBox, Wii等的支持没有测试过。
Launching a new game, interacting with friends in the buddy-list or moderating a chat is a matter of a few method calls. Additionally the client can access all the extra functionalities exposed by the custom Extensions, offering a limitless set of possibilities.
开始一个新的游戏,跟好友列表里的好友聊天只是几个方法的调用。此外客户端可以额外的订制自己的扩展,能够提供无限的可能。