Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala Akka Http websocket连接失败:非法状态异常:无法多次订阅同一订阅服务器_Scala_Websocket_Akka Stream_Akka Http - Fatal编程技术网

Scala Akka Http websocket连接失败:非法状态异常:无法多次订阅同一订阅服务器

Scala Akka Http websocket连接失败:非法状态异常:无法多次订阅同一订阅服务器,scala,websocket,akka-stream,akka-http,Scala,Websocket,Akka Stream,Akka Http,我的akka http websocket连接有问题。我使用HandleMessagesWithInkSource(sinkUsesActor、SFPTextMessage)处理websocket消息。sinkUsesActor使用一个参与者,而SFPTextMessage是来自actorpublisher的源。 当我刷新浏览器并尝试重新建立连接时,错误显示: java.lang.IllegalStateException: can not subscribe the same subscrib

我的akka http websocket连接有问题。我使用HandleMessagesWithInkSource(sinkUsesActor、SFPTextMessage)处理websocket消息。sinkUsesActor使用一个参与者,而SFPTextMessage是来自actorpublisher的源。 当我刷新浏览器并尝试重新建立连接时,错误显示:

java.lang.IllegalStateException: can not subscribe the same subscriber multiple times .
在这种情况下,如何使用来自actorpublisher(SFPTextMessage)的相同源

def wsHandler: HttpRequest ⇒ HttpResponse = {
        case req: HttpRequest ⇒ req.header[UpgradeToWebsocket] match {
            case Some(upgrade) ⇒
                upgrade.handleMessagesWithSinkSource(sinkUsesActor , SFPTextMessage )
            case None ⇒ HttpResponse(400, entity = "Missing Upgrade header")
        }
    }