我想在 Haskell 上编写 WebSocket 服务器。包里websockets有一个runServer函数。示例应用程序使用它。但文档说它只能在测试应用程序中使用,而不是在实际中使用。
如何使用最佳实践和更快的现代解决方案为我的服务器编写简单的模板?GHC 7.8.3。
方法getFirst()和getSecond()这个类的同时被调用.它是Web应用程序的一部分.
内部地图也填充,没有并发.
public class MyClass {
private Map<String, List<List<String>>> first;
private Map<String, List<List<String>>> second;
public MyClass() {
first = new ConcurrentHashMap<>();
second = new ConcurrentHashMap<>();
}
public Set<String> getFirst(String key, String token, int a, int b) {
return get(first, key, token, a, b);
}
public Set<String> getSecond(String key, String token, int a, int b) {
return get(second, key, token, a, b);
}
private Set<String> get(final Map<String, List<List<String>>> map, final String key, final String token,
final int …Run Code Online (Sandbox Code Playgroud)