abh*_*nav 7 channel elixir kubernetes phoenix-framework
我按照这一系列文章在Google Cloud上创建了一个部署.除了凤凰频道外,一切都按预期工作.
后端没有错误.在Javascript前端我在使用频道时获得第一个通道ERROR然后在前端使用套接字CLOSES.并且这在10-20秒的间隔内不断重复.
CHANNEL ERROR!
SOCKET CLOSE!
CHANNEL ERROR!
SOCKET CLOSE!
Run Code Online (Sandbox Code Playgroud)
从这段代码:
socket.connect()
socket.onError( e => console.log("SOCKET ERROR", e) )
socket.onClose( e => console.log("SOCKET CLOSE", e))
channel = socket.channel("note:" + noteId, {})
channel.onError( e => console.log("CHANNEL ERROR!", e) )
channel.onClose( e => console.log("CHANNEL CLOSED!", e) )
Run Code Online (Sandbox Code Playgroud)
我需要帮助来调试它并找出这个问题的起源.如果需要任何代码,请告诉我,我将使用该代码更新问题.现在已经一周了.:(
非常感谢!
(在本地运行时没问题)
更新:我看到的唯一区别是在本地服务器上,phoenix.js不断发送心跳,但这不会发生在服务器上.
更新:
---- my-ingress.yaml ----
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
# ingress.kubernetes.io/rewrite-target: /
kubernetes.io/ingress.class: "gce"
kubernetes.io/ingress.global-static-ip-name: my-ingress-ip
kubernetes.io/tls-acme: "true"
spec:
rules:
- host: apiv2.example.com
http:
paths:
- path: /*
backend:
serviceName: my-service-nodeport
servicePort: 80
- path: /.well-known/acme-challenge
backend:
serviceName: kube-lego-gce
servicePort: 8080
tls:
- secretName: my-secret-tls-7
hosts:
- apiv2.example.com
Run Code Online (Sandbox Code Playgroud)
更新:我实现了这个代码(我在开发工具中检查了框架,它们正在发送).但仍然......它给出了SOCKER ERROR.可能是问题不是发送听力.
const HEARTBEAT_INTERVAL_MS = 5000
socket.onOpen(() => {
clearInterval(this.heartbeatTimer);
this.heartbeatTimer = setInterval(() => {
return socket.push({
topic: "phoenix",
event: "heartbeat",
payload: {},
ref: socket.makeRef(),
});
},
HEARTBEAT_INTERVAL_MS
);
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
527 次 |
最近记录: |