python-eel/Eel

Trying to send data to specific users.

Open

#410 aberto em 21 de nov. de 2020

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Python (570 forks)batch import
help wanted

Métricas do repositório

Stars
 (5.980 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

*I am trying to send information from python to the frontend to different users, but it arrives to all the users.

Hello, I have a javascript that is able to modify the innerHTML of an element

function modifyElementById(ID, content){
	document.getElementById(ID).innerHTML = content;
}

I use it to send information depending on which button the user presses.

When I call it from python it modifies the element in all the clients, and not just in the one that clicked the button.

I also created a function that prints something in the console when the server says so because i wanted to test if that also arrived to all the clients, and it did, all the consoles printed the same at the same time.

function print_stuff(stuff){
	console.log(stuff);
}

My python side looks like this

import eel

def get_local_ip():
	sock = socket(AF_INET, SOCK_DGRAM)
	sock.connect(("8.8.8.8", 8080))
	return sock.getsockname()[0]

eel.init("GUI")
eel.start("index.html", host=get_local_ip(), port=5000)

Is there a way I can modify this element in each individual client depending on what do they do?

I also thought of making it different, like returning the HTML that i want to put in the client and then letting the client edit it by its own, but i am not sure if the data is going to be sent to all the clients.

I hope you can answer. thanks.

Guia do colaborador