WebSocket请求响应子协议(WebSocket request-response subprotocol)
WebSocket提供像人类谈话的双向通信。 客户端可以向服务器发送数据,服务器可以随时向客户端发送数据。 但是问题呢? 请求响应行为? 客户端可以向服务器询问一些信息,等待响应。 似乎Websocket不提供任何将客户端数据(请求)链接到服务器数据(响应)。
这可能是子协议的工作,我有一些关于如何做的想法(用请求发送一个id,并等待具有相同ID的响应,直到超时时间)。
为了不重画轮子并节省一些时间,我在互联网上查看了一个现有的解决方案,但是我没有找到任何相关的东西(也许是坏的关键字)。
那么有人知道这种工作,还是我错过了什么?
WebSocket provide a bi-directional communication like a human being talks. The client can send data to the server and the server can send data to the client at anytime. But what about the question ? the request-response behavior ? The client could ask something to the server and wait for a response. It seems that Websocket doesn't provide anything to link client data (request) to server data (response).
It's probably the work of the subprotocol and I have some ideas on how to do it (send a id with the request and wait for a reponse with the same id until a timeout period).
In order to do not remake the wheel and to save some time, I looked over the internet for a existing solution but I haven't found anything related (maybe bad keywords).
So is there anyone aware about this kind of work or am I missing something ?
原文:https://stackoverflow.com/questions/10882370
最满意答案
它似乎并不是使用LIKE将是你所需要的最好的方法。 我会研究MySQL FULLTEXT索引来获得基本的功能。 我将不得不多看一些复数的东西,看看是否可以实现。
查看FULLTEXT索引信息的这两个链接。
- http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html
- http://www.petefreitag.com/item/477.cfm
- http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html
这是第二篇文章的一个片段:
SELECT headline, story FROM news WHERE MATCH (headline,story) AGAINST ('Hurricane');
更新:
我发现这个SO帖子 ,其中的评论似乎表明,FULLTEXT索引将考虑到复数和语法形式,但他并没有引用来源,所以我很难肯定地说。 你可以尝试FULLTEXT索引方法吗?
It dosn't seem that using LIKE would be the best approach for what you need. I would look into MySQL FULLTEXT indexing to get the basic functionality working. I'll have to look into the plural thing a bit more to see if that can be accomplished.
Take a look at these two links for FULLTEXT indexing info.
- http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html
- http://www.petefreitag.com/item/477.cfm
- http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html
Here is a snippet from the second article:
SELECT headline, story FROM news WHERE MATCH (headline,story) AGAINST ('Hurricane');
UPDATE:
I found this SO post in which a comment seems to suggest that the FULLTEXT indexing will take plural and grammatical forms into account but he dosn't cite a source, so it's hard for me to say for sure. Can you try the FULLTEXT indexing method?
相关问答
更多-
SQL复数/单数搜索(SQL plural/singular searches)[2022-09-15]
它似乎并不是使用LIKE将是你所需要的最好的方法。 我会研究MySQL FULLTEXT索引来获得基本的功能。 我将不得不多看一些复数的东西,看看是否可以实现。 查看FULLTEXT索引信息的这两个链接。 http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html http://www.petefreitag.com/item/477.cfm http://dev.mysql.com/doc/refman/5.1/en/fulltext-boole ... -
这里直接来自微软: http://msdn.microsoft.com/en-us/library/4x252001(VS.71).aspx 对于大多数枚举类型使用单数名称,但对于位字段的枚举类型使用复数名称。 Here it is straight from Microsoft: http://msdn.microsoft.com/en-us/library/4x252001(VS.71).aspx Use a singular name for most Enum types, but use a pl ...
-
IMHO,表名应该是像客户一样的复数。 如果客户端映射到Customers表中的一行,则类名称应该与Customer类似。 IMHO, Table names should be plural like Customers. Class names should be singular like Customer if it maps to a row in Customers table.
-
REST URI约定 - 在创建资源时单数或复数名称的资源(REST URI convention - Singular or plural name of resource while creating it)[2022-04-03]
使用/resources的前提是它代表“全部”资源。 如果你做一个GET /resources ,你可能会返回整个集合。 通过POST /resources ,您正在添加到集合。 但是,个人资源在/资源中可用。 如果你做了一个GET /resource ,你可能会出错,因为这个请求没有任何意义,而/resource/123是完美的。 使用/resource而不是/resources类似于如果您使用文件系统和文件集合,并且/resource是其中的个人456文件的“目录”,您将如何执行此操作。 无论是对还是错 ... -
您可以搜索嵌套属性,它只需要稍微不同的语法。 您必须指定路径,然后明确使用您正在搜索的每个属性的路径。 本教程很好地概述了嵌套文档的工作方式 。 You can search nested properties, it just requires slightly different syntax. You have to specify the path, and then explicitly use the path for each property you are searching. This ...
-
你确定你想到了吗? 你有字符串"Templates selected" ,你有条件地将s附加到它的末尾 (这将使它成为"Templates Selecteds" )。 做这个: $('#templateCount').html(templateCount + " Template" + (templateCount === 1 ? "" : "s") + " Selected"); Are you sure you thought this through? You have ...
-
使用字典,停用词列表(您不想单词化)以及语言规则。 如果您不认识荷兰语,那么我无法帮助您,但会告诉您如何用西班牙语完成,例如: 复数以s结尾,如果没有则完成 如果它以s结尾, 检查它是否是以s结尾的动词或共轭,如果是1,则完成(动词可以添加到停用词列表中) 如果它不是动词,请删除s 如果单词存在于字典中,那就完成了 如果它没有删除前一个字母,并在字典中检查它。 如果它仍然不在那里它是一个例外你需要手动检查异常中的代码(我现在不能想到任何,但它们总是存在:) 当然,这不会直接转化为荷兰语。 一般情况下,提取器 ...
-
单数复数取决于国家(singular plural depending on state)[2023-07-25]
好吧,你需要有条件地输出你现在没有做的's'。 $('.mixcount').html(state.totalShow+' player'+(state.totalShow !== 1 ? 's' : '')); Well, you need to conditionally output the 's', which you're not currently doing. $('.mixcount').html(state.totalShow+' player'+(state.totalShow !== ... -
正则表达式 - 如何搜索单数或复数形式的单词[重复](Regex - How to search for singular or plural version of word [duplicate])[2023-11-01]
好的,我找到了一个解决方案: ([a-zA-Z]+?)(s\b|\b) 根据需要工作,然后您可以简单地使用第一个匹配作为单词的非数字化版本。 谢谢@Jahroy帮助我找到它。 我为未来的冲浪者添加了这个答案,他们只是想要一个解决方案,但请查看Jahroy的更多深入信息的评论。 Ok I've found a solution: ([a-zA-Z]+?)(s\b|\b) Works as desired, then you can simply use the first match as the unp ... -
用于搜索复数或单数特定python的正则表达式(Regular expression to search for plural or singular of specific python)[2023-05-10]
量词应用于左侧的原子。 如果它是一个组,它将应用于一个组。 如果它是文字符号,则它将应用于此符号。 那么, s? 匹配1或0 s 。 使用 x = re.findall(r'\bdogs?\b', txt) 其中\b是单词边界, s是可选的。 注意:首选使用原始字符串文字来定义正则表达式模式,以避免与转义特殊正则表达式元字符相关的问题。 A quantifier is applied to the atom on the left. If it is a group, it will be applied ...