-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
实现了使用websocket功能将命令发送至后端python服务器运行,
- Loading branch information
1 parent
e1f24b7
commit 816c655
Showing
6 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#encoding:utf-8 | ||
import asyncio | ||
import websockets | ||
import os | ||
|
||
async def echo(websocket): | ||
async for message in websocket: | ||
print("message:"+message) | ||
if(message[:6] == "ffmpeg"): | ||
os.system(message) | ||
await websocket.send("run command") | ||
print("运行命令完成") | ||
elif(message=="start"): | ||
await websocket.send("link start") | ||
else: | ||
await websocket.send("receive") | ||
|
||
async def main(): | ||
async with websockets.serve(echo, "localhost", 1652): | ||
print("start server") | ||
print("version:1.0") | ||
print("update date:2023.08.03") | ||
await asyncio.Future() # run forever | ||
|
||
asyncio.run(main()) |