from gluon import *
from gluon.contrib.websocket_messaging import websocket_send

from http_util import GET_HOST

def WEBSOCKET_SEND(_room, _type, _data):
    websocket_send('http://127.0.0.1:8888', _data, '67c371fd204fbcbf9742310d1a9d951bcca1aa86', _room.code)

def GET_URL(_room):
    if current.request.env.wsgi_url_scheme == "https":
        protocol = "wss"
    else:
        protocol = "ws"

    return(protocol+"://"+GET_HOST()+":8888/realtime/"+_room.code)