If it's Firefox they're using, this placed at the beginning of your first javascript for the page or as the code of a javascript you place first on the page, might stop it:
Code:
const namespam = 0;
You could also try:
Code:
setInterval(function(){namespam = function(){};}, 1);
However, even if one of these works, all they would have to do is change the name of the function and it would work again.
What's the socket? Is it something on your end? Regardless, you could also try redefining it:
To prevent errors in other browsers, you may need to encapsulate the code(s) you use in try/catch, ex:
Code:
try{const socket = {};}catch(e){}
Bookmarks