I guess you're trying to build a server health monitoring tool with Laravel.
As you pointed out that they are two different servers, and different programming language environment, you may need to write a webhook (which is bascially an API) for the Javascript program to call.
Of course you will also need to catch the error in your Javascript system and calls a webhook to your Laravel system.
Let your frontend javascript send the message to the Redis server. Write a little backend javascript that also connects to the Redis server to retrieve the messges.
PHP supports web sockets but is not always the best way to do it. If you use Laravel check out Laravel Broadcasting
发布评论
评论(2)
我猜您正在尝试使用 Laravel 构建服务器健康监控工具。
正如您所指出的,它们是两个不同的服务器,以及不同的编程语言环境,您可能需要编写一个Webhook(本质上是一个API)供Javascript程序调用。
当然,您还需要捕获 Javascript 系统中的错误并向 Laravel 系统调用 Webhook。
I guess you're trying to build a server health monitoring tool with Laravel.
As you pointed out that they are two different servers, and different programming language environment, you may need to write a webhook (which is bascially an API) for the Javascript program to call.
Of course you will also need to catch the error in your Javascript system and calls a webhook to your Laravel system.
您可以使用 Redis 服务器。
让您的前端 javascript 将消息发送到 Redis 服务器。编写一些后端 JavaScript,它还连接到 Redis 服务器以检索消息。
PHP 支持 Web 套接字,但并不总是最好的方法。如果您使用 Laravel,请查看 Laravel Broadcasting
You can use a Redis server.
Let your frontend javascript send the message to the Redis server. Write a little backend javascript that also connects to the Redis server to retrieve the messges.
PHP supports web sockets but is not always the best way to do it. If you use Laravel check out Laravel Broadcasting