python-eel/Eel

Trying to send data to specific users.

Open

#410 建立於 2020年11月21日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Python (570 fork)batch import
help wanted

倉庫指標

Star
 (5,980 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

*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.

貢獻者指南