I'm use RxScala/Java construct a Observable to emit socket connection with a loop,the result is every connection as a event.Like this,
val server = new ServerEntrance("localhost", 10002)
val socket: Observable[ConnectedSocket] = server.listen
After that, connection able to start reading.I need subscribe the scoket
connection event and make it as a new Observable.
ConnectedSocket
can use stratReading
,return Observable[CompletedProto]
,creating a Observable as connection do.It emit event with received information.I want to make this statement return Observable[CompletedProto]
.How to construct it?
socket.subscribe(l => l.startReading)
If need detail information I really willing update it.