@@ -30,7 +30,7 @@ class BlazeClient private constructor(
3030 private var reconnectInterval = 5000
3131
3232 private val okHttpClient: OkHttpClient by lazy {
33- createHttpClient(safeUser, true , debug)
33+ createHttpClient(safeUser, null , true , debug)
3434 }
3535
3636 private var webSocket: WebSocket ? = null
@@ -80,7 +80,8 @@ class BlazeClient private constructor(
8080 serverPublicKey : ByteArray? = null,
8181 spendPrivateKey : ByteArray? = null,
8282 ): Builder {
83- safeUser = SafeUser (userId, sessionId, sessionPrivateKey.sliceArray(0 .. 31 ), serverPublicKey, spendPrivateKey)
83+ safeUser =
84+ SafeUser (userId, sessionId, sessionPrivateKey.sliceArray(0 .. 31 ), serverPublicKey, spendPrivateKey)
8485 return this
8586 }
8687
@@ -124,8 +125,7 @@ class BlazeClient private constructor(
124125 }
125126
126127 override fun onMessage (webSocket : WebSocket , bytes : ByteString ) {
127- try {
128- // 消息通的时,重置连接次数
128+ try { // 消息通的时,重置连接次数
129129 connectCount = 0
130130
131131 val blazeMsg = decodeAs(bytes, parseData)
@@ -163,17 +163,26 @@ fun sendMsg(webSocket: WebSocket, action: Action, msgParam: MsgParam?): Boolean
163163}
164164
165165fun sendTextMsg (webSocket : WebSocket , conversationId : String , recipientId : String , text : String ): Boolean {
166- val msgParam = MsgParam (UUID .randomUUID().toString(), Category .PLAIN_TEXT .toString(), conversationId, recipientId, text)
166+ val msgParam =
167+ MsgParam (UUID .randomUUID().toString(), Category .PLAIN_TEXT .toString(), conversationId, recipientId, text)
167168 return sendMsg(webSocket, Action .CREATE_MESSAGE , msgParam)
168169}
169170
170171fun sendCardMsg (webSocket : WebSocket , conversationId : String , recipientId : String , cards : Cards ): Boolean {
171- val msgParam = MsgParam (UUID .randomUUID().toString(), Category .APP_CARD .toString(), conversationId, recipientId, Gson ().toJson(cards))
172+ val msgParam = MsgParam (
173+ UUID .randomUUID().toString(), Category .APP_CARD .toString(), conversationId, recipientId, Gson ().toJson(cards)
174+ )
172175 return sendMsg(webSocket, Action .CREATE_MESSAGE , msgParam)
173176}
174177
175178fun sendButtonsMsg (webSocket : WebSocket , conversationId : String , recipientId : String , buttons : List <Buttons >): Boolean {
176- val msgParam = MsgParam (UUID .randomUUID().toString(), Category .APP_BUTTON_GROUP .toString(), conversationId, recipientId, Gson ().toJson(buttons))
179+ val msgParam = MsgParam (
180+ UUID .randomUUID().toString(),
181+ Category .APP_BUTTON_GROUP .toString(),
182+ conversationId,
183+ recipientId,
184+ Gson ().toJson(buttons)
185+ )
177186 return sendMsg(webSocket, Action .CREATE_MESSAGE , msgParam)
178187}
179188
0 commit comments