'websockets_links
:param request: The HTTP request object.
:param response: The HTTP response object
:return: None, all results are saved in the kb.'

def grep(self, request, response):

    if (not response.is_text_or_html()):
        return
    if (not ((WS_URL in response.body) or (WSS_URL in response.body))):
        return
    url = request.get_url()
    if JavaScriptParser(response).can_parse(response):
        ws_links = find_websockets_links(response.body)
    else:
        ws_links = set()
        get_tags = mp_doc_parser.get_tags_by_filter
        for tag in get_tags(response, ('script',), yield_text=True):
            for ws_link in find_websockets_links(tag.text):
                ws_links.add(ws_link)
    if (len(ws_links) == 0):
        msg = 'The    URL    "%s"    has    signs    of    HTML5    WebSockets    usage,    but    failed    to    find    any    useful    links.    Perhaps    links    are    dynamically    created    using    javascript.    Manual    inspection    of    the    page    source    is    recommended.'
        om.out.debug((msg % url))
    for ws_link in ws_links:
        desc = 'The    URL:    "%s"    uses    HTML5    websocket    "%s"'
        desc %= (url, ws_link)
        i = Info('HTML5    WebSocket    detected', desc, response.id, self.get_name())
        i.set_url(url)
        i[WebSocketInfoSet.ITAG] = ws_link
        self.kb_append_uniq_group(self, 'websockets_links', i, group_klass=WebSocketInfoSet)
