Skip to content

Commit

Permalink
Updated from origin
Browse files Browse the repository at this point in the history
  • Loading branch information
shanelk committed Dec 6, 2023
2 parents dc96aa1 + 1ed265f commit 6fe825f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LiveObserveModelApi<Model : HasId<UUID>>(
}
}

fun <T : HasId<ID>, ID:Comparable<ID>> Observable<ListChange<T>>.toListObservable(ordering: Comparator<T>): Observable<List<T>> {
fun <T : HasId<ID>, ID: Comparable<ID>> Observable<ListChange<T>>.toListObservable(ordering: Comparator<T>): Observable<List<T>> {
val localList = ArrayList<T>()
return map {
it.wholeList?.let { localList.clear(); localList.addAll(it.sortedWith(ordering)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fun multiplexedSocketRaw(
}
message.data != null -> {
// println("Got ${message.data} to ${message.channel}")
current.onNext(message.data)
current.onNext(message.data!!)
null
}
message.end -> {
Expand Down Expand Up @@ -171,7 +171,7 @@ fun multiplexedSocketRaw(
}
.doOnDispose {
// println("Disconnecting channel on socket to $shortUrl with $path")
sharedSocket?.write?.onNext(
sharedSocket.write.onNext(
WebSocketFrame(
text = MultiplexMessage(
channel = channel,
Expand Down
6 changes: 3 additions & 3 deletions ios/LightningServer/Classes/client/live/sockets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ public func multiplexedSocketRaw(url: String, path: String, queryParams: Diction
if text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { return nil }
return (text.fromJsonString() as MultiplexMessage?)
}).filter { (it) -> Bool in it.channel == channel }
var current = PublishSubject()
var current: PublishSubject<String> = PublishSubject()
return multiplexedIn
.compactMap({ (message) -> WebSocketIsh<String, String>? in run { () -> WebSocketIsh<String, String>? in
if message.start {
// println("Channel ${message.channel} established with $sharedSocket")
return (WebSocketIsh(messages: current as Observable<String>, send: { (message) -> Void in sharedSocket.write.onNext(WebSocketFrame(text: MultiplexMessage(channel: channel, data: message).toJsonString())) } as (String) -> Void) as WebSocketIsh<String, String>)
} else if message.data != nil {
// println("Got ${message.data} to ${message.channel}")
current.onNext(message.data)
current.onNext(message.data!)
return nil
} else if message.end {
// println("Channel ${message.channel} terminated")
Expand All @@ -101,7 +101,7 @@ public func multiplexedSocketRaw(url: String, path: String, queryParams: Diction
}
} })
.doOnSubscribe { (_) -> Void in sharedSocket.write.onNext(WebSocketFrame(text: MultiplexMessage(channel: channel, path: path, queryParams: queryParams, start: true).toJsonString())) }
.doOnDispose { () -> Void in sharedSocket?.write.onNext(WebSocketFrame(text: MultiplexMessage(channel: channel, path: path, end: true).toJsonString())) }
.doOnDispose { () -> Void in sharedSocket.write.onNext(WebSocketFrame(text: MultiplexMessage(channel: channel, path: path, end: true).toJsonString())) }
.retry(when: { (it) -> Observable<Error> in
let temp = retryTime
retryTime = temp * 2
Expand Down

0 comments on commit 6fe825f

Please sign in to comment.