SlideShare a Scribd company logo
1 of 21
Phát triển ứng dụng đa nền tảng
– SmartFox Server
Phạm NgọcThủy –Tamtay JSC
Nội dung trình bày
 Tại sao lại chọn SmartFox server(SFS)?
 Cấu trúc, tính năng SFS
 Cơ sở lập trình SFS: Các phase của SFS
 SFSExtension
 SFS Class
 Ví dụ về các game có thể phát triển dựa trên SFS
Tại sao lại dùng SmartFox?
 Tiềm năng của các game multiplayer trên mobile.
 Sử dụng trong quá trình mobile hóa ứng dụng.
 Phát triển các ứng dụng mobile độc lập.
SFS – Cấu trúc
Tính năng
 Server core
 Platform
 Client
Cấu trúc Zone/Room
Cài đặt
 Server
 Client
SFS Phase: Connection
 2 bước thực hiện kết nối:
 Mở kết nối vật lýTCP tới server.
 Client và server thực hiện kết nối và trao đổi các thông tin cấu
hình.
 Hệ thống Highly Resilient Connection (HRC):
 CONNECTION_RETRY
 CONNECTION_RESUME
Connection phase: Code iOS
_smartFox = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self];
[_smartFox loadConfig:@"config.xml" connectOnSuccess:YES];
Config.xml:
<SmartFoxConfig>
<ip>127.0.0.1</ip>
<port>9933</port>
<blueBoxIpAddress>127.0.0.1</blueBoxIpAddress>
<blueBoxPort>8080</blueBoxPort>
<smartConnect>true</smartConnect>
<httpPort>8080</httpPort>
<httpPollSpeed>750</httpPollSpeed>
<zone>BasicExamples</zone>
</SmartFoxConfig>
Connection phase: Code iOS
SmartFox2XClient * client = [[SmartFox2XClient alloc]
initSmartFoxWithDebugMode:YES delegate:self];
[client connect:@"127.0.0.1" port:9933];
SFS Phase: Login
 Default_login
 Custom_login
 Params:
 User_name
 Password
 Zone_name
 Extra_params
Login phase: Code iOS
Custom login:
[client send:[LoginRequest requestWithUserName:[UserName] password:[Pass]
zoneName:@”[ZoneName]" params:nil]];
Default login:
[client send:[LoginRequest requestWithUserName:loginName password:@"" zoneName:nil
params:nil]];
Or:
[client send:[LoginRequest request]];
SFS Phase: Join, create room
 Tạo room mới:
 Tĩnh
 Động
 JoinRoomRequest:
 Id
 Pass
 Room_to_leave
 As_spect
Join, create room: Code iOS
C1: [client send:[JoinRoomRequest requestWithId:@”[RoomName]"]];
C2: : [client send:[JoinRoomRequest requestWithId:[RoomName]
pass:[RoomPassword] roomIdToLeave:[IDLastRoom] asSpect:[Spectator?]]];
Create room:
[client send:[CreateRoomRequest requestWithRoomSettings:[RoomSettings]]];
ClientAPI
 Public APIs
 Custom Requests
PublicAPIs: Code iOS
 SendRequest:
[client send:[PublicMessageRequest requestWithMessage:str]];
 Response:
-(void)onPrivateMessage:(SFSEvent *)evt
{
SFSUser *sender = [evt.params objectForKey:@"sender"];
NSLog(@"PM: %@, from: %@", [evt.params
objectForKey:@"message"], sender.name);
}
SFSExtension
 ZoneLevelExtension
 RoomLevelExtension
 ServerAPI
 APIClasses
 Services
 DataClasses
SFSExtension: Code iOS
SendRequest:
[client send:[ExtensionRequest requestWithExtCmd:
@”[CommandName]" params:[Params]]];
Response:
-(void)onExtensionResponse:(SFSEvent *)evt
{
NSString *str = [evt.params objectForKey:@"cmd"];
SFSObject *obj = [evt.params objectForKey:@"params"];
}
Bạn đã sẵn sàng?
 Ý tưởng sản phẩm.
 Nhân lực.
 Server.
 Client:
 iOS: Mac OS, iOS SDK, Xcode
 Android:Android SDK, Eclipse
Ví dụ về game có thể triển khai
 Turn based games.
 Audition phiên bản mobile?
Hỏi & Đáp
Chân thành cảm ơn!
Thông tin diễn giả:
Phạm NgọcThủy –Trưởng nhóm mobile
Email:Thuy.pham@tamtay.vn
Công ty Cổ phầnTamtay – Số 43 LàngYên Phụ -Tây Hồ - Hà
Nội

More Related Content

More from AiTi Education

AiTi Education Profile
AiTi Education ProfileAiTi Education Profile
AiTi Education ProfileAiTi Education
 
AiTi Education Software Testing Session 03
AiTi Education Software Testing Session 03AiTi Education Software Testing Session 03
AiTi Education Software Testing Session 03AiTi Education
 
AiTi Education Software Testing Session 02 b
AiTi Education Software Testing Session 02 bAiTi Education Software Testing Session 02 b
AiTi Education Software Testing Session 02 bAiTi Education
 
AiTi Education Software Testing Session 02 a
AiTi Education Software Testing Session 02 aAiTi Education Software Testing Session 02 a
AiTi Education Software Testing Session 02 aAiTi Education
 
AiTi Education Software Testing Session 01 b
AiTi Education Software Testing Session 01 bAiTi Education Software Testing Session 01 b
AiTi Education Software Testing Session 01 bAiTi Education
 
AiTi Education Software Testing Session 01 a
AiTi Education Software Testing Session 01 aAiTi Education Software Testing Session 01 a
AiTi Education Software Testing Session 01 aAiTi Education
 
Vietnam mobile internet_2014_mwork_vietnam_mobile_day
Vietnam mobile internet_2014_mwork_vietnam_mobile_dayVietnam mobile internet_2014_mwork_vietnam_mobile_day
Vietnam mobile internet_2014_mwork_vietnam_mobile_dayAiTi Education
 
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...AiTi Education
 
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...AiTi Education
 
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...AiTi Education
 
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...AiTi Education
 
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...AiTi Education
 
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...AiTi Education
 
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...AiTi Education
 
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...AiTi Education
 
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - Ng...
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - 	 Ng...[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - 	 Ng...
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - Ng...AiTi Education
 
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...AiTi Education
 
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014 - Nguyễn Thàn...
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014  - Nguyễn Thàn...[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014  - Nguyễn Thàn...
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014 - Nguyễn Thàn...AiTi Education
 
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....AiTi Education
 
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....AiTi Education
 

More from AiTi Education (20)

AiTi Education Profile
AiTi Education ProfileAiTi Education Profile
AiTi Education Profile
 
AiTi Education Software Testing Session 03
AiTi Education Software Testing Session 03AiTi Education Software Testing Session 03
AiTi Education Software Testing Session 03
 
AiTi Education Software Testing Session 02 b
AiTi Education Software Testing Session 02 bAiTi Education Software Testing Session 02 b
AiTi Education Software Testing Session 02 b
 
AiTi Education Software Testing Session 02 a
AiTi Education Software Testing Session 02 aAiTi Education Software Testing Session 02 a
AiTi Education Software Testing Session 02 a
 
AiTi Education Software Testing Session 01 b
AiTi Education Software Testing Session 01 bAiTi Education Software Testing Session 01 b
AiTi Education Software Testing Session 01 b
 
AiTi Education Software Testing Session 01 a
AiTi Education Software Testing Session 01 aAiTi Education Software Testing Session 01 a
AiTi Education Software Testing Session 01 a
 
Vietnam mobile internet_2014_mwork_vietnam_mobile_day
Vietnam mobile internet_2014_mwork_vietnam_mobile_dayVietnam mobile internet_2014_mwork_vietnam_mobile_day
Vietnam mobile internet_2014_mwork_vietnam_mobile_day
 
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...
[Vietnam Mobile Day 2014] Tăng doanh thu quảng cáo cho mobile site và ứng dụn...
 
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...
[Vietnam Mobile Day 2014] Mobile money - Xu hướng thanh toán nhỏ trên mobile ...
 
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...
[Vietnam Mobile Day 2014] Mobile kết nối thế giới số và thế giới thực và vai ...
 
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...
[Vietnam Mobile Day 2014] The new mobile marketing channel: Social Wifi Marke...
 
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...
[Vietnam Mobile Day 2014] Cá nhân hóa và xác định Khách hàng mục tiêu trong q...
 
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...
[Vietnam Mobile Day 2014] Chiến lược thu hút người dùng cho ứng dụng tại thị ...
 
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...
[Vietnam Mobile Day 2014] Thanh toán mobile, hiện tại và xu hướng- Nguyễn Chi...
 
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...
[Vietnam Mobile Day 2014] Thanh toán bằng thẻ ngân hàng trên mobile chưa bao ...
 
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - Ng...
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - 	 Ng...[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - 	 Ng...
[Vietnam Mobile Day 2014] How to build a mobile store app in 5 minutes - Ng...
 
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...
[Vietnam Mobile Day 2014] Touch the future of the web - Nguyễn Việt Anh - Cou...
 
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014 - Nguyễn Thàn...
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014  - Nguyễn Thàn...[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014  - Nguyễn Thàn...
[Vietnam Mobile Day 2014] Xu hướng trong Mobile Learning, 2014 - Nguyễn Thàn...
 
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
 
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
[Vietnam Mobile Day 2014] Toàn cảnh thị trường game smartphone Việt Nam 2013....
 

[Vietnam Mobile Day 2013] - Phát triển ứng dụng game đa nền tảng smart fox server

  • 1. Phát triển ứng dụng đa nền tảng – SmartFox Server Phạm NgọcThủy –Tamtay JSC
  • 2. Nội dung trình bày  Tại sao lại chọn SmartFox server(SFS)?  Cấu trúc, tính năng SFS  Cơ sở lập trình SFS: Các phase của SFS  SFSExtension  SFS Class  Ví dụ về các game có thể phát triển dựa trên SFS
  • 3. Tại sao lại dùng SmartFox?  Tiềm năng của các game multiplayer trên mobile.  Sử dụng trong quá trình mobile hóa ứng dụng.  Phát triển các ứng dụng mobile độc lập.
  • 5. Tính năng  Server core  Platform  Client
  • 8. SFS Phase: Connection  2 bước thực hiện kết nối:  Mở kết nối vật lýTCP tới server.  Client và server thực hiện kết nối và trao đổi các thông tin cấu hình.  Hệ thống Highly Resilient Connection (HRC):  CONNECTION_RETRY  CONNECTION_RESUME
  • 9. Connection phase: Code iOS _smartFox = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self]; [_smartFox loadConfig:@"config.xml" connectOnSuccess:YES]; Config.xml: <SmartFoxConfig> <ip>127.0.0.1</ip> <port>9933</port> <blueBoxIpAddress>127.0.0.1</blueBoxIpAddress> <blueBoxPort>8080</blueBoxPort> <smartConnect>true</smartConnect> <httpPort>8080</httpPort> <httpPollSpeed>750</httpPollSpeed> <zone>BasicExamples</zone> </SmartFoxConfig>
  • 10. Connection phase: Code iOS SmartFox2XClient * client = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self]; [client connect:@"127.0.0.1" port:9933];
  • 11. SFS Phase: Login  Default_login  Custom_login  Params:  User_name  Password  Zone_name  Extra_params
  • 12. Login phase: Code iOS Custom login: [client send:[LoginRequest requestWithUserName:[UserName] password:[Pass] zoneName:@”[ZoneName]" params:nil]]; Default login: [client send:[LoginRequest requestWithUserName:loginName password:@"" zoneName:nil params:nil]]; Or: [client send:[LoginRequest request]];
  • 13. SFS Phase: Join, create room  Tạo room mới:  Tĩnh  Động  JoinRoomRequest:  Id  Pass  Room_to_leave  As_spect
  • 14. Join, create room: Code iOS C1: [client send:[JoinRoomRequest requestWithId:@”[RoomName]"]]; C2: : [client send:[JoinRoomRequest requestWithId:[RoomName] pass:[RoomPassword] roomIdToLeave:[IDLastRoom] asSpect:[Spectator?]]]; Create room: [client send:[CreateRoomRequest requestWithRoomSettings:[RoomSettings]]];
  • 15. ClientAPI  Public APIs  Custom Requests
  • 16. PublicAPIs: Code iOS  SendRequest: [client send:[PublicMessageRequest requestWithMessage:str]];  Response: -(void)onPrivateMessage:(SFSEvent *)evt { SFSUser *sender = [evt.params objectForKey:@"sender"]; NSLog(@"PM: %@, from: %@", [evt.params objectForKey:@"message"], sender.name); }
  • 17. SFSExtension  ZoneLevelExtension  RoomLevelExtension  ServerAPI  APIClasses  Services  DataClasses
  • 18. SFSExtension: Code iOS SendRequest: [client send:[ExtensionRequest requestWithExtCmd: @”[CommandName]" params:[Params]]]; Response: -(void)onExtensionResponse:(SFSEvent *)evt { NSString *str = [evt.params objectForKey:@"cmd"]; SFSObject *obj = [evt.params objectForKey:@"params"]; }
  • 19. Bạn đã sẵn sàng?  Ý tưởng sản phẩm.  Nhân lực.  Server.  Client:  iOS: Mac OS, iOS SDK, Xcode  Android:Android SDK, Eclipse
  • 20. Ví dụ về game có thể triển khai  Turn based games.  Audition phiên bản mobile?
  • 21. Hỏi & Đáp Chân thành cảm ơn! Thông tin diễn giả: Phạm NgọcThủy –Trưởng nhóm mobile Email:Thuy.pham@tamtay.vn Công ty Cổ phầnTamtay – Số 43 LàngYên Phụ -Tây Hồ - Hà Nội