Category:开源软件/Actor/Server

来自RoomChat
跳转至: 导航搜索

iOS[编辑]

编译步骤 / Build[编辑]

Configuration[编辑]

文件存储 / File Storage[编辑]

可以选择用 AWS S3,或者直接存储在服务器上

推送[编辑]

配置样本:

 # Accessing Apple servers for push notifications
 apple {
   # Safari & iOS notifications
    push {
   #  Mobile push certificates
     certs = [
       {
         key: 20160111
         path: "/srv/actor-server-2016/actbox.p12"
         password: actbox
         sandbox: no
       }
      ]
    }
 }
  • 生成 p12 文件:先从 Apple developer 网站下载对应的生产环境 push 证书 aps.cer,双击倒入到 Keychain。打开 Keychain Access,左侧选 login 和 Certificates,找到生产环境 push 证书,左侧按钮不要展开,点 Export,输入密码(配置样本中的 actbox)导出,如。导出文件上传到服务器(配置样本中的 "/srv/actor-server-2016/actbox.p12")。
  • 需要客户端和服务器设置一个相同的 apiPushId,上面的配置中数值为 20160111,客户端也需要设置。比如 iOS:ActorSDK.sharedActor().apiPushId = 20160111

使用[编辑]

数据备份[编辑]

mkdir -p /srv/actor-server-2016/db/
sudo -u postgres pg_dump actor > /tmp/actor.psql; mv /tmp/actor.sql /srv/actor-server-2016/db/`date +"%Y-%m-%d-%H-%M"`.psql

可以把导出放在 crontab 中。比如在 Ubuntu 中写入到文件 /etc/cron.daily/actor

删除已读消息[编辑]

Actor 默认纪录所有聊天记录。消息删除也只是标记删除(如 history_messages 的 deleted_at 不为 NULL 就表示已删除)。

  • 物理删除用户删除信息:
delete FROM "history_messages" where deleted_at is not NULL;
  • 删除已读消息:
delete from "history_messages" using user_dialogs  where
 history_messages.user_id = user_dialogs.user_id 
 AND history_messages.peer_type = user_dialogs.peer_type
 AND history_messages.peer_id = user_dialogs.peer_id
 AND history_messages.date < user_dialogs.last_read_at;

测试帐号[编辑]

选择 Russia,然后手机号前缀 555,后面的一位数字重复4次即为验证码

  • 手机号:+7 5551234567
  • 验证码:1111

数据库[编辑]

user_phones[编辑]

用户手机号

history_messages[编辑]

消息历史。

Column	Type	Comment
user_id	integer	 消息 owner user id
peer_type	integer	 
peer_id	integer	 peer user id,1 为点对点消息,2为群聊
date	timestamp	 
sender_user_id	integer	 
random_id	bigint	 
message_content_header	integer	 
message_content_data	bytea	 
deleted_at	timestamp NULL	 如果非 NULL,那么消息已被删除

Indexes
INDEX	message_content_header
PRIMARY	user_id, peer_type, peer_id, date, sender_user_id, random_id

user_dialogs[编辑]

对话。对话过程中是通过更新 last_received_at 以及 last_read_at 来标记消息状态(未发送,已发送,已读)。如果要清理消息,可以遍历这个数据库。

Column	Type	Comment
user_id	integer	 
peer_type	integer	 
peer_id	integer	 
last_message_date	timestamp NULL	 
last_received_at	timestamp NULL	 
last_read_at	timestamp NULL	 
owner_last_received_at	timestamp	 
owner_last_read_at	timestamp	 
is_archived	boolean NULL [false]	 
created_at	timestamp NULL [now()]	 
shown_at	timestamp NULL [now()]	 
is_favourite	boolean [false]	 

Versions[编辑]

1.0.133[编辑]

Release note: https://github.com/actorapp/actor-platform/blob/master/actor-server/notes/1.0.133.markdown

bug: guarantee unique send message date in dialog

Comments:

Jan. 28
李金山@LiJinshan 22:35
For latest ios code, I remove old ios app and run again,
favorite
22:36
It have some error ,INVALID_ACCESS_HASH :
2016-01-28 22:33:29.646 ActorApp[351:42419] WARRING ApiBroker: <- error#30: INVALID_ACCESS_HASH 403  in 178 ms
ACRpcException: 
	at 0x00000001011fe000 ACRpcException.<init>() + 176
	at 0x00000001011ce948 ACApiBroker.processResponse() + 3772
	at 0x00000001011d0630 ACApiBroker.onReceive() + 1456
	at 0x0000000100dd53ec ARActorDispatcher.processEnvelope() + 4888
	at 0x0000000100f56e80 ARGenericDispatcherActor_$1.dispatchMessage() + 92
	at 0x0000000100dd0d2c ImActorRuntimeActorsDispatchAbstractDispatcher.dispatchMessage() + 116
	at 0x0000000100f58974 ARGenericDispatcherThreads_DispatcherThread.run() + 1228
	at 0x00000001012622a0 java.lang.Thread.run0() + 32
2016-01-28 22:33:29.807 ActorApp[351:43445] EventBus: Event: dialogs_closed
2016-01-28 22:34:04.220 ActorApp[351:42418] ApiBroker: -> request#31: rpc SetOnline{isOnline=true, timeout=90000}
2016-01-28 22:34:04.419 ActorApp[351:42421] ApiBroker: <- response#31: response Void{} in 198 ms
favorite
22:40
The history messages can not synchronize and new message can not been sent.
favorite
23:45
The old web app can not sync someone's history messages with latest server (1.0.133) too.

1.0.135[编辑]

Release note: https://github.com/actorapp/actor-platform/blob/master/actor-server/notes/1.0.135.markdown

rocket: Upgraded Akka to 2.4.2-RC1, faster websockets!
rocket: Upgraded akka-persistence-jdbc to 2.4.2-RC1 compatible version, faster persistence!
bug: Fixed websocket disconnects
bug: Fixed session messages ordering

Comments: Fixed message sync issue for actbox server 1.0.100

1.0.147[编辑]

Comments:

Raid6:26
Server version .147 and .148 are not starting correctly for some reason, client wont connect

Andrew Smith@prettynatty6:32
147 had a bug

6:32
server wasn't able to start up

6:32
148 fixed it

Raid6:59
Oh, right, had to restart it again

6:59
Working again

本分类目前不含有任何页面或媒体文件。