mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
docker: add container websocket in docker-compose
This commit is contained in:
@@ -15,17 +15,15 @@ import websockets
|
||||
|
||||
async def enviar_mensagem(msg):
|
||||
try:
|
||||
uri = "ws://192.168.1.150:8765"
|
||||
uri = "ws://websocket_server:8765"
|
||||
async with websockets.connect(uri) as websocket:
|
||||
await websocket.send(msg)
|
||||
print(f"> Enviado: {msg}")
|
||||
# print(f"> Enviado: {msg}")
|
||||
|
||||
resposta = await websocket.recv()
|
||||
print(f"< Recebido: {resposta}")
|
||||
# resposta = await websocket.recv()
|
||||
# print(f"< Recebido: {resposta}")
|
||||
except Exception as e:
|
||||
print(f"Erro ao enviar mensagem: {e}")
|
||||
|
||||
|
||||
print(f"Erro ao enviar mensagem via websocket: {e}")
|
||||
|
||||
|
||||
def somar(consumo:ProductComanda, comanda:Comanda):
|
||||
@@ -87,7 +85,7 @@ def addProduct(request, product_id, comanda_id):
|
||||
'speak': f'Novo pedido! {product.name}, para {comanda.name}.'
|
||||
})
|
||||
|
||||
# asyncio.run(enviar_mensagem(msg))
|
||||
asyncio.run(enviar_mensagem(msg))
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
valores = somar(consumo,comanda)
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ def addContaCliente(request):
|
||||
clientId = int(request.POST.get('select-client'))
|
||||
comanda = Comanda.objects.get(id=comandaId)
|
||||
client = Client.objects.get(id=clientId)
|
||||
# client.debt = Decimal(0)
|
||||
comanda.client = client
|
||||
comanda.dt_close = timezone.now()
|
||||
comanda.status = 'FIADO'
|
||||
|
||||
Reference in New Issue
Block a user